当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Angular JS : Scope values is not displayed in H1 tags

问题描述:

i have this template:

Problem is that, i am able to ng-if, but statement

<h2>{{$verification.state}}</h2>

Does not provide any visible output (H2 tag is empty, without text)

<div ng-controller="UsersCtrl" ng-init="verifyUser()" class="jumbotron">

<!- Verification Progres Icon-->

<p class="lead">

<i ng-if="verification.state == 'progress'" class="fa fa-thumbs-o-up fa-5x"></i>

<i ng-if="verification.state == 'success'" class="fa fa-thumbs-o-up fa-5x"></i>

<i ng-if="verification.state == 'error'" class="fa fa-exclamation-circle fa-5x"></i>

</p>

<!- Verification Progres Text Description-->

<h2>{{$verification.state}}</h2>

<h2>{{$verification}}</h2>

<!- Verification Progres Buttons-->

<p>

<a ng-if="verification.state == 'success'" class="btn btn-lg btn-success" ng-href="#/users/login">

Let me to login!

<span class="glyphicon glyphicon-ok"></span>

</a>

<a ng-if="verification.state == 'error'" class="btn btn-lg btn-success" ng-href="#/users/verify/token/{{verification.token}}">

Try it again

<span class="glyphicon glyphicon glyphicon-exclamation-sign"></span>

</a>

</p>

</div>

In controller I'm setting up values to templet like this:

// set initial progress state

$scope.verification = {

state:"progress"

};

How can I pass correctly and display values to the:

<h2>{{$verification.state}}</h2>

Thanks for any help.

网友答案:

Omit the dollar sign:

<h2>{{verification.state}}</h2>
网友答案:

Instead of {{$verification.state}} use {{verification.state}} it should work

分享给朋友:
您可能感兴趣的文章:
随机阅读: