None
None

Reputation: 5670

Dynamic change of angular expression not working

I have an angular expression for ng-show attribute.

      <div style="height: 200px" class="collect-parcel" ng-show="{{shipment.type==1}}">
</div>

and in my controller

 $scope.shipment={type:2}

and in a click event I am changing the value like this

$scope.shipment.type = 1;

And when this click happens I expect the div to show, which is not happening for some unknown reason.

after the click event my rendered HTML is like this

  <div style="height: 200px" class="collect-parcel ng-hide" ng-show="true">

                    </div>

I Can't understand why the div is till not showing?

Upvotes: 1

Views: 275

Answers (1)

dfsq
dfsq

Reputation: 193311

It should be an expression:

ng-show="shipment.type == 1"

By the way, I recommend to keep developer console open all the time. In this case you would have notices an error message saying that {{ is not a valid expression something.

Upvotes: 2

Related Questions