html - How to make "configurable directives"? -
Say I have directive elements:
& lt; Monkey-grid & gt; & Lt; //
Monkey Grid & gt; Now, say that I want to include some "options" so that monkey-grid.tpl.html render in a specific function, and reuse it in different circumstances. can be done. & lt; Monkey-Grid Tabbed & gt; & Lt; / Monkey-grid & gt; & Lt ;! - Also tried - & gt; & Lt; Monkey-Grid Tocked = "True" & gt; & Lt; / Monkey-grid & gt; Then in my monkey-grid template, I want to do something like that, but it does not work, even if I have set it on the lie (hence the original element remains). I just want to show the appropriate div.
& lt; Div & gt; & Lt; Div ng-show = "tabbed == true" & gt; Tab & lt; / Div & gt; & Lt ;! - Also tried - & gt; & Lt; Div ng-show = "vertical" & gt; VERTICAL & lt; / Div & gt; & Lt; / Div & gt; Is there a better way to create "configurable instructions" for better word deficiency?
Instructions:
(Instructions ('App Directive') Instructions ('Monkey Grid', Function () {Return (Restricted: 'E', Replace: Wrong, Controller: 'Moktor Controller', Template: 'Main / App / Component / Mokini Grid / Mokini-Grid. Tpl.html'};});} ());
In fact, you need to pass the property in scope:
(function () {'use strict'; angular.module ('App.Directives') vertical: '= vertical', tabbed: '= tabbed'} , Controller: 'Monk Controller', Template URL: 'Main / app / components / mkeni grid / mokini-grid.tpl.html'};}); < } ());
You can parse bound objects like using the @ operator: scope: {fooey: '@ fooy'} , This threw me because usually in a template you arbitrarily define Of which can be hard on the properties. The reason you can not do this is because they are lost during the angular compilation phase, and you have explicitly asked them to compile / compile them.
You can use more compression. The variable name is built in:
scope: {vertical: '=', tabid: '='},
Comments
Post a Comment