How to write HTML code in $rootScope variable using angularJS? -
i trying change value of label in html page on event,is possible insert html code variable?
the html
code like:
<div ng-controller="welcomecon" ><label>{{ welcomemsg }}</label></div>
and in controller
in script:
$rootscope.welcomemsg="you not logged in,please log in or register"
is there way make words log in
, register
links? if no, happy if guide me in alternative.
thanks
you can other answers suggest using $sce
service or ng-bind-html
, object approach because links won't change, why defining html in code instead of in html.
what want this:
<ul class="my-menu"> <li ng-if="$root.loggedin"> <a href="url/to/logout">logout</a> </li> <li ng-if="!$root.loggedin"> not logged in, please <a href="login">login</a> or <a href="register">register</a> </li> </ul>
Comments
Post a Comment