Angular JS Routing and Multiple Views with examples

  • callback(true); } } // Delete the user from Users returnObject.deleteUser = function(user){ /* * $scope.users.indexOf(user) :- indexOf return the current index of user , *that user we want to delete ..
  • // and inject the $scope angular.module(‘userApp’).controller(‘usersCtrl’,function($scope,userService){ // Blank New User Object $scope.newUser = {}; // Array of Users: that contain the user List $scope.users = userService.users; // Add new User $scope.addUser = function(user){ userService.addUser(user,function(isUserAdded){ $scope.newUser = {}; }); }; $scope.deleteUser = userService.deleteUser; }); // create the our User Controller that contain all business login for add delete users.
  • controller(‘userDetailCtrl’,function($scope,$routeParams,userService){ // our controller get access to route parameter(userID) via the AngularJS $routeParams service var userID = $routeParams.userID; userService.getUserForID(userID,function(user){ $scope.user = user; }); });

Read the full article, click here.


@VASIMHAYAT1: “Angular JS Routing and Multiple Views with examples
#angularjs #routing”


What is Routing in AngularJS? Learn Routing and multiple views in Angular JS using the ngRoute. Building a demo with Angular JS Routing.


Angular JS Routing and Multiple Views with examples

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.