i define a directive in angularjs that have a url to fetch data from data base. i display part of code. my directive is :
app.directive('getData', function() {
return {
restrict: 'E',
scope: {
url: '@',
suggestion: '=data'
},
controller: ['$scope','$http', function($scope,$http){
$http.get($scope.url)
.success(function (data) {
console.log(data);// display data
$scope.Items = data;
});
})
template:
<li\
suggestion\
ng-repeat="suggestion in suggestions track by $index"\
</li>\
}
now when i create a directive such as this in html
<get-data url="/public/getEmployee" data="Items"></get-data>
but no data display in it, while same code in directive controller be in an angularjs controller work correctly.
getDataand your usage ismy-directive?