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.

ng-init doc


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -