Created
June 24, 2013 20:00
-
-
Save thompson4822/5853064 to your computer and use it in GitHub Desktop.
Defining AngularJS directives in CoffeeScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@angular.module('HelloApp', ['components']) | |
@angular.module('components', []) | |
.directive('testElem', -> | |
restrict: 'A' | |
template: '<div class="my-directive-class"><h1>Hello...</h1><p ng-repeat="obj in arr">{{obj}}</p></div>' | |
link: (scope, iterStartElement, attr) -> | |
$(".my-directive-class").css({ 'background-color': 'yellow'}) | |
scope.arr = ["Steve", 'is', 'the', 'beast'] | |
) | |
.directive('helloWorld', -> | |
restrict: 'E' | |
scope: | |
name: '@name' | |
templateUrl: 'assets/html/partials.html' | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment