tl;dr: change the value of scope variable and based on this rerender a directive. If I use isAccepted: '=?' I receive Expression used with directive '' is non-assignable!if I use isAccepted: '@' it doesn't work (isAccepted value changes, but the view doesn't reren.
Here's a scope of my playerView:
scope: {
isAccepted: '=?',
player: '='
},
If isAccepted=true I wanna show a div with a green icon (otherwise I show a div with a gray icon) to show the player's view:
<div class="player-green-container" ng-if="::ctrl.isAccepted">
<div class="player-gray-container" ng-if="::!ctrl.isAccepted">
The problem is that if a user presses on a icon I want it to display the other div (gray -> green, green -> gray), so if a user presses gray icon we should change the value of this.isAccepted (I did it already) and (the most important part) I didn't manage to work: to rerender .html directive.
UPD: some code from directive:
<div class="player-list">
<comment-view class="player-list-item"
player="p"
is-accepted="ctrl.playerIds.indexOf(p.id) > -1"></comment-view>
</div>
In my controller I've got the following:
@export {boolean}
this.isAccepted;
Here's my directive:
When I replace @ with = console.log(this.isAccepted) outputs either true, false, but if I replace = with @ console.log outputs outputs string value: "ctrl.playerIds.indexOf(p.id) > -1"
Is there any way I can force it to evaluate to true/false (still using '@') (I tried eval() and it doesn't work - I still get a string)?
Is it possible?
Thanks.