Cleaner directive, factory and filter syntax
This release contains three new files:
These files are helper files to make creating directives, factories and filters quicker and easier. They follow the same concept as the radian-controller.coffee
and radian-service.coffee
files.
Here's an example of how to create a new directive using radian-directive.coffee
:
define [
'config'
'directive/radian-directive'
], (cfg, RD) ->
RD 'stub', [
'$rootScope'
], ($rootScope) ->
templateUrl: cfg.path.partial + 'directive/stub-partial.html'
restrict: 'A'
replace: true
scope:
items: '=ngModel'
link: ($scope, $element, $attrs) ->
It used to be like this:
define [
'config'
'angular'
], (cfg, A) ->
stubDirective = () ->
templateUrl: cfg.path.partial + 'directive/stub-partial.html'
restrict: 'A'
replace: true
scope:
items: '=ngModel'
link: ($scope, $element, $attrs) ->
app = A.module cfg.ngApp
app.directive 'stub', stubDirective
So now it's a lot cleaner and faster, and as the bulk of the creation logic has been moved to a static helper (the radian-module-helper.coffee
) it means there's also less memory overhead.
Enjoy!