socek

Untitled

Jul 2nd, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var add_controller= function(obj, ctrl) {
  2.     var args = ctrl.args.slice();
  3.     args.push(ctrl.method);
  4.     return obj.controller(ctrl.name, args);
  5. };
  6.  
  7. var ctrl = {
  8.     name: 'PhoneListCtrl',
  9.     args: ['$scope', '$http',],
  10.     method: function ($scope, $http) {
  11.         $http.get('phones/phones.json').success(
  12.             function(data) {
  13.                 $scope.phones = data;
  14.             }
  15.         );
  16.  
  17.         $scope.orderProp = 'age';
  18.     }
  19. };
  20.  
  21. add_controller(phonecatApp, ctrl);
Advertisement
Add Comment
Please, Sign In to add comment