angularjs - difference between '@' and '=' when testing directives -
I am currently trying to get my head around the test instructions and came into some weird behavior. My code is as follows:
Angular Module ('tddApp', []). Directive ('weird button', function () {return} {template: ' , replace: right, scope: {market1: = ', Market2:' @ '}};}); Before (each (function () () () (before html = '& lt; div odds-button market1) (' obstruction buttons directive test suite ', function () {var $ scope, scope, elem, html; before (Each module ('tddApp')) = "market" market 2 = "market" & gt; & lt; / div & gt; '; Inject (function ($ Collection, $ Rootscope) {$ scope = $ rootScope. $ New (); $ scope.market = '2/1'; Elem = angular.element (html); $ compile (elem) ($ scope); scope = elem.isolateScope (); scope. $ Apply (); });}); It is expected that ('should be created and HTML should be changed') (different There should be market in the field, work ()) (hopefully (scope.market1). Tobe ('2/1'); Hopefully (scope.market2). TB ('2/1');}) ;}); When I go into the market for a different scope, using two 'binding' = ', works as expected, but when I only I read '@' then it gets a string instead of 'Market'
< p> When you pass it by '@', then in fact it is only in priority Q will read VALUE To do this, you do not have to tell angular to resolve the value of the value with the {{}} pattern. Change it html:
html = '& lt; Div odds-button market1 = "market" market2 = "{{market}}" & gt; & Lt; / div & gt; '; This works for me.
Comments
Post a Comment