daily pastebin goal
1%
SHARE
TWEET

script

a guest Jul 18th, 2013 40 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2.  
  3. angular.module('ngView', [], function($routeProvider, $locationProvider) {
  4.   $routeProvider.when('/angular/:bookId', {
  5.     templateUrl: 'tpl/detal.tpl',
  6.     controller: BookCntl,
  7.   });
  8.   $routeProvider.when('/angular/:name/:chapterId', {
  9.     templateUrl: 'tpl/detal.tpl',
  10.     controller: ChapterCntl
  11.   });
  12.  
  13.   $routeProvider.otherwise({redirectTo: '/angular'});
  14.   $locationProvider.html5Mode(true).hashPrefix('!');
  15.  
  16. });
  17.  
  18. function MainCntl($scope, $route, $routeParams, $location) {
  19.   $scope.$route = $route;
  20.   $scope.$location = $location;
  21.   $scope.$routeParams = $routeParams;
  22. }
  23.  
  24. function BookCntl($scope, $routeParams, $http) {
  25.  
  26.   $http.get('angular/' + $routeParams.bookId).success(function(data) {
  27.     $scope.book = data;
  28.    
  29.   });
  30.   $scope.name = "BookCntl";
  31.   $scope.params = $routeParams;
  32.  
  33. }
  34.  
  35.  
  36. function ChapterCntl($scope, $routeParams, $http) {
  37.     $http.get('angular/' + $routeParams.name + '/' + $routeParams.chapterId).success(function(data) {
  38.     $scope.book = data;
  39.    
  40.   });
  41.   $scope.name = "ChapterCntl";
  42.   $scope.params = $routeParams;
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top