Firstly, I found the api address from this thread: Laravel 4 and Angular JS and Twitter Bootstrap 3 Pagination
Now I'm working on this, my little script is this:
var app = angular.module('kategori', [ 'ngResource', 'apiBaseRoute' ]); app.factory('Data', ['$resource', 'apiBaseRoute', function($resource, config){ return $resource('http://develop.alexei.me/careers/careers.php?callback=JSON_CALLBACK&page=:page', { page: 1 }, { 'get': { method: 'JSONP' } }); }]); app.controller('KategoriListCtrl', function($scope, Data){ $scope.init = function() { Data.get({}, function(response){ $scope.kategoriList = response.careers; },function(error){ console.log("HATA VAR" + error); }); }; }); app.directive('paginate', function(){ return{ scope:{ allData: '=paginate2' }, link: function(scope){ console.log(scope); } } });
And this is the html side:
<div class="col-md-6 col-md-offset-3" ng-controller="KategoriListCtrl" ng-init="init()"> {{kategoriList}} <div paginate paginate2="kategoriList"></div> </div>
as you can see, console.log (scope) inside the directive shows a lot of things in the console, especially I see allData there with big data, but if I change it to
console.log(scope.allData)
it prints undefined ..
I do not understand why. how can i solve this? thanks.
source share