Created
August 6, 2013 21:54
-
-
Save SerhiiKozachenko/6169081 to your computer and use it in GitHub Desktop.
Angular directive with ng-repeat inside and cached templates.
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
'use strict'; | |
(function() { | |
var categoryItem = function(templateCache){ | |
return { | |
restrict: 'E', | |
replace: true, | |
transclude: false, | |
scope: { items:'=in'}, | |
// Use templateCache instead of templateUrl | |
template: templateCache.get('category-item'), | |
// The linking function will add behavior to the template | |
link: function(scope, element, attrs) { | |
} | |
} | |
}; | |
categoryItem.$inject = ['$templateCache']; | |
angular.module('MerchApp').directive('categoryItem', categoryItem); | |
})(); |
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
// Templates go here | |
ng-include(src="'/templates/template'") |
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
!!! 5 | |
html | |
head | |
script(type="text/ng-template", id="category-item") | |
.category-item.col-lg-3(ng-repeat="category in items") | |
.thumbnail | |
.caption | |
h3 {{category.title}} | |
p Category description | |
button.btn.btn-primary Details | |
body |
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
.row | |
category-item(in="Categories") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment