123456789101112131415161718192021222324 |
- angular.module("noteWrangler")
- .directive('nwCard', function () {
- return {
- retrict: "E", // "E" is for Element.
- templateUrl: "templates/directives/nw-card.html",
- /* By default, directives have "scope: false": they inherit from their
- parents, so setting properties on the scope actually sets them on the
- parent scope. Setting the scope to a non empty value creates an isolated
- scope for the child... so it no longer has access to the parent scope.
- So we pass the required parts of the parent scope to the directive in the
- HTML attributes (see notes.html). But then we can't use the inline
- controller, the directive needs to know it can receive a header from the
- notes.html template.
- */
- scope: {
- // "@" means we'll be passing header as a (1-way) string.
- // Also available: "=" (2-way binding, expression brackets no longer
- // needed around note.header) and "&".
- header: "=",
- icon: "=",
- },
- }
- });
|