I need to watch a property of one of my inner html elements (li tag) inside a directive. I have tried it, but not able to get that. My html is as given below:
<div id="notificationsTile">
<div class="blue">
<div class="step">
<ul ng-repeat="item in Model.DisplayNotifications">
<li itemPriority = {{item.Priority}}>
<h3>{{ item.EndDate | date: 'dd MMMM' }}</h3>
<p>{{ item.NotificationName }}</p>
</li>
</ul>
</div>
</div>
</div>
I need to watch the itemPriority. The watch is as given below:
scope.$watch("itemPriority", function(newVal, oldVal){
debugger;
});
My directive is as given below:
notificationsTileModule.directive('spNotificationsTile', function (spNotificationsService, spSessionStorageService) {
return {
restrict: 'E',
replace: true,
scope: {
priority: '=itemPriority'
},
templateUrl: '/_catalogs/masterpage/SPDP.Portal/Views/NotificationTile/NotificationTile.html',
link: function (scope, element, attrs) {
var model = scope.Model = {
DisplayNotifications: []
};
//model.Priority = scope.itemPriority;
scope.$watch('priority', function(newVal, oldVal){
debugger;
});
}
});
Where am I going wrong?