angularjs - Can I declare a variable in html? -
given
<li>document printing - <a href="http://{{displaysandbox()}}/{{displaycase()}}/printingservice/documentprintingservice.svc"> <span ng-class="{true:'value',false:'invalid'}[(sandbox && validcase())==true]">http://<span class="sandbox">{{displaysandbox()}}</span>.companyname.com/<span class="case">{{displaycase()}}</span>/printingservice/documentprintingservice.svc</span></a> <span ng-bind-html-unsafe="geturl('/printingservice/documentprintingservice.svc')"> </span> </li>
i declare wrap in
<div ng-var="subpath=/printingservice/printingservice.svc>
so inside scope able
<li>document printing - <a href="http://{{displaysandbox()}}/{{displaycase()}}{{subpath}}"> <span ng-class="{true:'value',false:'invalid'}[(sandbox && validcase())==true]">http://<span class="sandbox">{{displaysandbox()}}</span>.companyname.com/<span class="case">{{displaycase()}}</span>{{subpath}}</span></a> <span ng-bind-html-unsafe="geturl(subpath)"> </span> </li>
is there way declare scope (for variable or 'constant' if will), via angular.js
in html?
using ng-init
, can initialize value below:
<data ng-init="subpath= '/printingservice/printingservice.svc'"/>
however, better use controller in such cases.
Comments
Post a Comment