AngularJS: ng-show / ng-hide not working with `{{ }}` interpolation AngularJS: ng-show / ng-hide not working with `{{ }}` interpolation angularjs angularjs

AngularJS: ng-show / ng-hide not working with `{{ }}` interpolation


The foo.bar reference should not contain the braces:

<p ng-hide="foo.bar">I could be shown, or I could be hidden</p><p ng-show="foo.bar">I could be shown, or I could be hidden</p>

Angular expressions need to be within the curly-brace bindings, where as Angular directives do not.

See also Understanding Angular Templates.


You can't use {{}} when using angular directives for binding with ng-model but for binding non-angular attributes you would have to use {{}}..

Eg:

ng-show="my-model"title = "{{my-model}}"


Try wrapping expression with:

$scope.$apply(function() {   $scope.foo.bar=true;})