title: Angularjs getting data from controller scope to directive scope
body: <p>I am trying to get data from resource then add it to isolate scope of directive but when i want to print it to screen i get error as undefined current_page here is the script</p>
  
  <pre><code>/**
       * Created by yigit on 10.01.2014.
       */
      var app = angular.module('kategori', [
          'ngResource',
          'apiBaseRoute'
      ]);
  
      app.factory('Data', ['$resource', 'apiBaseRoute', function($resource, config){
          return $resource(config.apiBasePath + 'kategori/?page=:page',{page:1},{
              query:{
                  isArray: false,
                  method: 'GET'
              }
          });
      }]);
  
      app.controller('KategoriListCtrl',['$scope', 'Data', function($scope, Data){
  
          $scope.allData = {data:null};
          Data.query({}, function(data){
              $scope.kategoriList = {data:data.cat.data};
              $scope.allData.data = data.cat;
          });
      }]);
      app.directive('paginate', function(){
          return{
              scope:{paginatorData: '=paginate'},
              link: function(scope){
                  alert(scope.paginatorData.current_page);
              }
          }
      });
  
  
  
  &lt;!DOCTYPE html&gt;
              &lt;html ng-app="kategori"&gt;
              &lt;head&gt;
                  &lt;meta charset="UTF-8"&gt;
                  &lt;title&gt;&lt;/title&gt;
                  &lt;link rel="stylesheet" href="css/bootstrap.min.css"&gt;
              &lt;/head&gt;
              &lt;body&gt;
              &lt;div class="col-md-6 col-md-offset-3" ng-controller="KategoriListCtrl"&gt;
              {{allData.current_page}}
                  &lt;div paginate="allData"&gt;&lt;/div&gt;
              &lt;/div&gt;
  
              &lt;script src="js/lib/angular.min.js"&gt;&lt;/script&gt;
              &lt;script src="js/lib/angular-resource.js"&gt;&lt;/script&gt;
              &lt;script src="js/kategori.js"&gt;&lt;/script&gt;
              &lt;script src="js/apiroute.js"&gt;&lt;/script&gt;
              &lt;/body&gt;
              &lt;/html&gt;
  </code></pre>
  
  <p>I read this article <a href="http://jimhoskins.com/2012/12/14/nested-scopes-in-angularjs.html" rel="nofollow">nested scope</a></p>
  
  <p>But could not solve my problem.</p>
  
  <p>So, the code alerts undefined. How can i solve this? </p>