diff options
Diffstat (limited to 'third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/angularjs/js/app.js')
-rw-r--r-- | third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/angularjs/js/app.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/angularjs/js/app.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/angularjs/js/app.js new file mode 100644 index 0000000000..5f30ea3a11 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/angularjs/js/app.js @@ -0,0 +1,32 @@ +/*global angular */ + +/** + * The main TodoMVC app module + * + * @type {angular.Module} + */ +angular.module('todomvc', ['ngRoute', 'ngResource']) + .config(function ($routeProvider) { + 'use strict'; + + var routeConfig = { + controller: 'TodoCtrl', + templateUrl: 'todomvc-index.html', + resolve: { + store: function (todoStorage) { + // Get the correct module (API or localStorage). + return todoStorage.then(function (module) { + module.get(); // Fetch the todo records in the background. + return module; + }); + } + } + }; + + $routeProvider + .when('/', routeConfig) + .when('/:status', routeConfig) + .otherwise({ + redirectTo: '/' + }); + }); |