I'm starting with angular and I have a question. I have the following scenario: I created a directive with the responsibility of displaying message on the screen. Below her code.
message.js
"use strict";
angular.module("layout")
.directive('mensagem', function () {
return {
restrict: 'EA',
templateUrl: '/Marcenaria/Scripts/App/Directive/Layout/mensagem.html',
scope:{
msgSucesso: '@',
msgError: '@',
msgInfo: '@'
}
}
});
message.html
<div ng-if="msgSucesso" class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h4> <i class="icon fa fa-check"></i> Sucesso!</h4>
{{msgSucesso}}
</div>
<div ng-if="msgError" class="alert alert-warning alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h4> <i class="icon fa fa-warning"></i> Atenção!</h4>
{{msgError}}
</div>
<div ng-if="msgInfo" class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h4><i class="icon fa fa-info"></i> Informativo!</h4>
{{msgInfo}}
</div>
Policy call
<mensagem msgError="{{msgError}}" msgSucesso="{{msgSucesso}}" msgInfo="{{msgInfo}}"></mensagem>
The question is, when I update msgError, for example, that information is not updated within the message directive and therefore does not print the message on the screen, how do I resolve it?