angularjs - pass data to directive controller -


i got problem angularjs. got data in json file. got service responsible retrieving data file. after getting data, pass directive, got undefined (when i'm passing constant value, string - not file - works). code:

html:

<experience-timeline ng-model="experience"/> 

controller:

myappcvexperiencemodule.controller('experiencectrl', function ($scope, dataservice) {      dataservice.getexpjson().success(function (res) {         $scope.experience = res;     });  }); 

directive:

myappmodule.directive('experiencetimeline', function () { return {     restrict: 'e',     require: ['ngmodel'],     scope: {         ngmodel: '=ngmodel'     },     controller : function($scope) {         console.log($scope.ngmodel); // undefined     },     templateurl: 'scripts/directives/experience-timeline/template/experience-timeline.html' } }); 

why should got undefined? how pass data correctly?


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -