Fairly new to ANGULAR!!
I have created a "directive" named "contactCard". What I'm trying to achieve with the help of this directive to display some json Data. But unfortunately data is not getting displayed.
[WORKING CODES ARE PLACED HERE ON PLUNKER]
I have this html:
<ul class="digi-alert-list" ng-controller="jsonNotify">
<li ng-repeat="notifications in notify">
<contact-card data="notifications"></contact-card>
</li>
</ul>
And MainAPP file:
(function () {
var app = angular.module("MainApp",
["ui.bootstrap","app.directives.contactCard"]
);
app.controller('jsonNotify', function($scope, $http) {
$http.get('notification.json')
.then(function(res){
$scope.notify = res.data;
});
});
})();
Finally contactCard.js
angular.module('app.directives.contactCard', [])
.directive('contactCard', function(){
return{
restrict: 'E',
scope: {
data: '='
},
template: '<div class="alert-report"><p>{{notifications.serveactivity}}</p></div>',
controller: function($scope){
alert("directives");
}
};
});