Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var app = angular.module("app", ["ngRoute"]);
- app.config(function ($routeProvider) {
- $routeProvider
- .when('/', {
- templateUrl: "app.html",
- controller: "ViewCtrl",
- resolve: {
- first: function () {
- return "Hello world";
- },
- second: function ($q, $timeout) {
- var defer = $q.defer();
- $timeout(function () {
- defer.reject("Your network is down");
- }, 500);
- return defer.promise;
- }
- }
- })
- });
- app.run(function ($rootScope) {
- $rootScope.$on("$routeChangeError", function (event, current, previous, rejection) {
- console.log(event);
- })
- });
- app.controller("ViewCtrl", function ($scope, first, second) {
- console.log(first, second);
- $scope.model = {
- message: "I'm a great app!"
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement