June 2014
Intermediate to advanced
696 pages
38h 52m
English
With the views finished, you need to implement the AngularJS controller code to support them. Listing 26.15 implements the AngularJS controller that supports the user view. The controller, like the web forms, is very basic. The controller uses the $http service to get the user data from the /user/profile route and provide it to the AngularJS template in the $scope.user value.
Listing 26.15 my_app.js: Implementing an AngularJS controller to get user data by using an $http request
01 angular.module('myApp', []).02 controller('myController', ['$scope', '$http',03 function($scope, $http) {04 $http.get('/user/profile')05 .success(function(data, ...
Read now
Unlock full access