Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
todomvc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eugene Shen
todomvc
Commits
da803b6b
Commit
da803b6b
authored
Mar 03, 2014
by
Pascal Hartig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AngularJS: Upgrade to 1.2.14 (angular+routing)
parent
9b1f5af8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1704 additions
and
1524 deletions
+1704
-1524
architecture-examples/angularjs/bower.json
architecture-examples/angularjs/bower.json
+3
-3
architecture-examples/angularjs/bower_components/angular-route/angular-route.js
...angularjs/bower_components/angular-route/angular-route.js
+55
-54
architecture-examples/angularjs/bower_components/angular/angular.js
...re-examples/angularjs/bower_components/angular/angular.js
+1646
-1467
No files found.
architecture-examples/angularjs/bower.json
View file @
da803b6b
...
...
@@ -2,11 +2,11 @@
"name"
:
"todomvc-angular"
,
"version"
:
"0.0.0"
,
"dependencies"
:
{
"angular"
:
"1.2.1
3
"
,
"angular"
:
"1.2.1
4
"
,
"todomvc-common"
:
"~0.1.4"
},
"devDependencies"
:
{
"angular-mocks"
:
"1.2.1
3
"
,
"angular-route"
:
"1.2.1
3
"
"angular-mocks"
:
"1.2.1
4
"
,
"angular-route"
:
"1.2.1
4
"
}
}
architecture-examples/angularjs/bower_components/angular-route/angular-route.js
View file @
da803b6b
/**
* @license AngularJS v1.2.1
3
* @license AngularJS v1.2.1
4
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
(
function
(
window
,
angular
,
undefined
)
{
'
use strict
'
;
/**
* @ngdoc
overview
* @ngdoc
module
* @name ngRoute
* @description
*
...
...
@@ -17,7 +17,6 @@
* ## Example
* See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
*
* {@installModule route}
*
* <div doc-module-components="ngRoute"></div>
*/
...
...
@@ -26,8 +25,8 @@ var ngRouteModule = angular.module('ngRoute', ['ng']).
provider
(
'
$route
'
,
$RouteProvider
);
/**
* @ngdoc
object
* @name
ngRoute.
$routeProvider
* @ngdoc
provider
* @name $routeProvider
* @function
*
* @description
...
...
@@ -49,8 +48,7 @@ function $RouteProvider(){
/**
* @ngdoc method
* @name ngRoute.$routeProvider#when
* @methodOf ngRoute.$routeProvider
* @name $routeProvider#when
*
* @param {string} path Route path (matched against `$location.path`). If `$location.path`
* contains redundant trailing slash or is missing one, the route will still match and the
...
...
@@ -66,10 +64,10 @@ function $RouteProvider(){
* * `path` can contain optional named groups with a question mark: e.g.`:name?`.
*
* For example, routes like `/color/:color/largecode/:largecode*\/edit` will match
* `/color/brown/largecode/code/with/slashs/edit` and extract:
* `/color/brown/largecode/code/with/slash
e
s/edit` and extract:
*
* * `color: brown`
*
* `largecode: code/with/slash
s`.
*
* `largecode: code/with/slashe
s`.
*
*
* @param {Object} route Mapping information to be assigned to `$route.current` on route
...
...
@@ -89,7 +87,7 @@ function $RouteProvider(){
*
* If `template` is a function, it will be called with the following parameters:
*
* - `{Array.
<Object>
}` - route parameters extracted from the current
* - `{Array.
<Object>
}` - route parameters extracted from the current
* `$location.path()` by applying the current route
*
* - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
...
...
@@ -97,7 +95,7 @@ function $RouteProvider(){
*
* If `templateUrl` is a function, it will be called with the following parameters:
*
* - `{Array.
<Object>
}` - route parameters extracted from the current
* - `{Array.
<Object>
}` - route parameters extracted from the current
* `$location.path()` by applying the current route
*
* - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
...
...
@@ -112,7 +110,7 @@ function $RouteProvider(){
*
* - `key` – `{string}`: a name of a dependency to be injected into the controller.
* - `factory` - `{string|function}`: If `string` then it is an alias for a service.
* Otherwise if function, then it is {@link a
pi/AUTO
.$injector#invoke injected}
* Otherwise if function, then it is {@link a
uto
.$injector#invoke injected}
* and the return value is treated as the dependency. If the result is a promise, it is
* resolved before its value is injected into the controller. Be aware that
* `ngRoute.$routeParams` will still refer to the previous route within these resolve
...
...
@@ -212,8 +210,7 @@ function $RouteProvider(){
/**
* @ngdoc method
* @name ngRoute.$routeProvider#otherwise
* @methodOf ngRoute.$routeProvider
* @name $routeProvider#otherwise
*
* @description
* Sets route definition that will be used on route change when no other route definition
...
...
@@ -239,8 +236,8 @@ function $RouteProvider(){
function
(
$rootScope
,
$location
,
$routeParams
,
$q
,
$injector
,
$http
,
$templateCache
,
$sce
)
{
/**
* @ngdoc
object
* @name
ngRoute.
$route
* @ngdoc
service
* @name $route
* @requires $location
* @requires $routeParams
*
...
...
@@ -255,7 +252,7 @@ function $RouteProvider(){
* - `$scope` - The current route scope.
* - `$template` - The current route template HTML.
*
* @property {Array.
<Object>
} routes Array of all configured routes.
* @property {Array.
<Object>
} routes Array of all configured routes.
*
* @description
* `$route` is used for deep-linking URLs to controllers and views (HTML partials).
...
...
@@ -276,7 +273,7 @@ function $RouteProvider(){
Note that this example is using {@link ng.directive:script inlined templates}
to get it working on jsfiddle as well.
<example
module="ngViewExample" deps="angular-route.js
">
<example
name="$route-service" module="ngRouteExample" deps="angular-route.js" fixBase="true
">
<file name="index.html">
<div ng-controller="MainCntl">
Choose:
...
...
@@ -309,7 +306,7 @@ function $RouteProvider(){
</file>
<file name="script.js">
angular.module('ng
View
Example', ['ngRoute'])
angular.module('ng
Route
Example', ['ngRoute'])
.config(function($routeProvider, $locationProvider) {
$routeProvider.when('/Book/:bookId', {
...
...
@@ -350,17 +347,17 @@ function $RouteProvider(){
}
</file>
<file name="protractor
Test.js
">
<file name="protractor
.js" type="protractor
">
it('should load and compile correct template', function() {
element(by.linkText('Moby: Ch1')).click();
var content = element(by.css('
.doc-example-live
[ng-view]')).getText();
var content = element(by.css('[ng-view]')).getText();
expect(content).toMatch(/controller\: ChapterCntl/);
expect(content).toMatch(/Book Id\: Moby/);
expect(content).toMatch(/Chapter Id\: 1/);
element(by.partialLinkText('Scarlet')).click();
content = element(by.css('
.doc-example-live
[ng-view]')).getText();
content = element(by.css('[ng-view]')).getText();
expect(content).toMatch(/controller\: BookCntl/);
expect(content).toMatch(/Book Id\: Scarlet/);
});
...
...
@@ -370,8 +367,7 @@ function $RouteProvider(){
/**
* @ngdoc event
* @name ngRoute.$route#$routeChangeStart
* @eventOf ngRoute.$route
* @name $route#$routeChangeStart
* @eventType broadcast on root scope
* @description
* Broadcasted before a route change. At this point the route services starts
...
...
@@ -387,8 +383,7 @@ function $RouteProvider(){
/**
* @ngdoc event
* @name ngRoute.$route#$routeChangeSuccess
* @eventOf ngRoute.$route
* @name $route#$routeChangeSuccess
* @eventType broadcast on root scope
* @description
* Broadcasted after a route dependencies are resolved.
...
...
@@ -403,8 +398,7 @@ function $RouteProvider(){
/**
* @ngdoc event
* @name ngRoute.$route#$routeChangeError
* @eventOf ngRoute.$route
* @name $route#$routeChangeError
* @eventType broadcast on root scope
* @description
* Broadcasted if any of the resolve promises are rejected.
...
...
@@ -417,8 +411,7 @@ function $RouteProvider(){
/**
* @ngdoc event
* @name ngRoute.$route#$routeUpdate
* @eventOf ngRoute.$route
* @name $route#$routeUpdate
* @eventType broadcast on root scope
* @description
*
...
...
@@ -432,8 +425,7 @@ function $RouteProvider(){
/**
* @ngdoc method
* @name ngRoute.$route#reload
* @methodOf ngRoute.$route
* @name $route#reload
*
* @description
* Causes `$route` service to reload the current route even if
...
...
@@ -565,7 +557,7 @@ function $RouteProvider(){
/**
* @returns the current active route, by matching it against the URL
* @returns
{Object}
the current active route, by matching it against the URL
*/
function
parseRoute
()
{
// Match a route
...
...
@@ -583,7 +575,7 @@ function $RouteProvider(){
}
/**
* @returns interpolation of the redirect path with the parameters
* @returns
{string}
interpolation of the redirect path with the parameters
*/
function
interpolate
(
string
,
params
)
{
var
result
=
[];
...
...
@@ -607,8 +599,8 @@ ngRouteModule.provider('$routeParams', $RouteParamsProvider);
/**
* @ngdoc
object
* @name
ngRoute.
$routeParams
* @ngdoc
service
* @name $routeParams
* @requires $route
*
* @description
...
...
@@ -617,7 +609,7 @@ ngRouteModule.provider('$routeParams', $RouteParamsProvider);
* Requires the {@link ngRoute `ngRoute`} module to be installed.
*
* The route parameters are a combination of {@link ng.$location `$location`}'s
* {@link ng.$location#
methods_search `search()`} and {@link ng.$location#methods_
path `path()`}.
* {@link ng.$location#
search `search()`} and {@link ng.$location#
path `path()`}.
* The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched.
*
* In case of parameter name collision, `path` params take precedence over `search` params.
...
...
@@ -630,14 +622,14 @@ ngRouteModule.provider('$routeParams', $RouteParamsProvider);
* Instead you can use `$route.current.params` to access the new route's parameters.
*
* @example
*
<pre>
*
```js
* // Given:
* // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
* // Route: /Chapter/:chapterId/Section/:sectionId
* //
* // Then
* $routeParams ==> {chapterId:1, sectionId:2, search:'moby'}
*
</pre>
*
```
*/
function
$RouteParamsProvider
()
{
this
.
$get
=
function
()
{
return
{};
};
...
...
@@ -649,7 +641,7 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
/**
* @ngdoc directive
* @name ng
Route.directive:ng
View
* @name ngView
* @restrict ECA
*
* @description
...
...
@@ -679,7 +671,9 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
* - Otherwise enable scrolling only if the `autoscroll` attribute value evaluated
* as an expression yields a truthy value.
* @example
<example module="ngViewExample" deps="angular-route.js" animations="true">
<example name="ngView-directive" module="ngViewExample"
deps="angular-route.js;angular-animate.js"
animations="true" fixBase="true">
<file name="index.html">
<div ng-controller="MainCntl as main">
Choose:
...
...
@@ -794,17 +788,17 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
}
</file>
<file name="protractor
Test.js
">
<file name="protractor
.js" type="protractor
">
it('should load and compile correct template', function() {
element(by.linkText('Moby: Ch1')).click();
var content = element(by.css('
.doc-example-live
[ng-view]')).getText();
var content = element(by.css('[ng-view]')).getText();
expect(content).toMatch(/controller\: ChapterCntl/);
expect(content).toMatch(/Book Id\: Moby/);
expect(content).toMatch(/Chapter Id\: 1/);
element(by.partialLinkText('Scarlet')).click();
content = element(by.css('
.doc-example-live
[ng-view]')).getText();
content = element(by.css('[ng-view]')).getText();
expect(content).toMatch(/controller\: BookCntl/);
expect(content).toMatch(/Book Id\: Scarlet/);
});
...
...
@@ -815,8 +809,7 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
/**
* @ngdoc event
* @name ngRoute.directive:ngView#$viewContentLoaded
* @eventOf ngRoute.directive:ngView
* @name ngView#$viewContentLoaded
* @eventType emit on the current ngView scope
* @description
* Emitted every time the ngView content is reloaded.
...
...
@@ -831,6 +824,7 @@ function ngViewFactory( $route, $anchorScroll, $animate) {
link
:
function
(
scope
,
$element
,
attr
,
ctrl
,
$transclude
)
{
var
currentScope
,
currentElement
,
previousElement
,
autoScrollExp
=
attr
.
autoscroll
,
onloadExp
=
attr
.
onload
||
''
;
...
...
@@ -838,12 +832,19 @@ function ngViewFactory( $route, $anchorScroll, $animate) {
update
();
function
cleanupLastView
()
{
if
(
currentScope
)
{
if
(
previousElement
)
{
previousElement
.
remove
();
previousElement
=
null
;
}
if
(
currentScope
)
{
currentScope
.
$destroy
();
currentScope
=
null
;
}
if
(
currentElement
)
{
$animate
.
leave
(
currentElement
);
$animate
.
leave
(
currentElement
,
function
()
{
previousElement
=
null
;
});
previousElement
=
currentElement
;
currentElement
=
null
;
}
}
...
...
architecture-examples/angularjs/bower_components/angular/angular.js
View file @
da803b6b
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment