The notifications show all the time. I print the values and they change from true to false correctly but the no-show is not affected. I have also tried setting the values in the controller: $scope.notification.show.no_results = !results.lenght - it didn't work. Any ideas?
Michael Bertolacci
unread,
Apr 18, 2013, 9:44:14 PM4/18/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ang...@googlegroups.com
Hello Sanja,
How are you triggering the changes?
You may need to wrap the code that changes $scope.results in $scope.$apply, which will trigger a digest so ng-show knows to update the visibility of the element.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ang...@googlegroups.com
Hi!
I'm assuming that you are using the <alert> directive from
http://angular-ui.github.io/bootstrap/ - hard to say for sure without
a live plunk code, but your markup and problem description makes me
think that you are taking about this project.
If so you are bumping into a scoping issue. Basically the alter
directive creates a new isolated scope and a given DOM element can
have only one scope assigned in AngularJS which means that the
ng-show/ng-hide directive evaluates against an isolated scope and not
your controller scope. A simple remedy is to use
$parent.results.length. Sample plunk here:
http://plnkr.co/edit/EkjTQHm32VLIligP8lsN?p=preview
We might review the strategy of using isolated scopes for alerts in
the future as those scoping issues seem to be a bit confusing.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ang...@googlegroups.com
Pawel -
I lost about an hour to this issue. I wasn't expecting alerts to create a new, isolated scope, ESPECIALLY since other attributes used in the alert DON'T use an isolated scope. Here's what a I mean:
While the type is set in the expected scope and I can directly access the myAlert object, in the ng-show expression, I have to INDIRECTLY access the SAME object. This is unexpected and incredibly confusing.