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
Sven Franck
todomvc
Commits
a2d55d9b
Commit
a2d55d9b
authored
Jan 01, 2014
by
Pascal Hartig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Angular: Upgrade to 1.2.6
parent
1239e6a6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
354 additions
and
184 deletions
+354
-184
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
+1
-1
architecture-examples/angularjs/bower_components/angular/angular.js
...re-examples/angularjs/bower_components/angular/angular.js
+350
-180
No files found.
architecture-examples/angularjs/bower.json
View file @
a2d55d9b
...
...
@@ -2,11 +2,11 @@
"name"
:
"todomvc-angular"
,
"version"
:
"0.0.0"
,
"dependencies"
:
{
"angular"
:
"1.2.
5
"
,
"angular"
:
"1.2.
6
"
,
"todomvc-common"
:
"~0.1.4"
},
"devDependencies"
:
{
"angular-mocks"
:
"1.2.
5
"
,
"angular-route"
:
"1.2.
5
"
"angular-mocks"
:
"1.2.
6
"
,
"angular-route"
:
"1.2.
6
"
}
}
architecture-examples/angularjs/bower_components/angular-route/angular-route.js
View file @
a2d55d9b
/**
* @license AngularJS v1.2.
5
* @license AngularJS v1.2.
6
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
...
...
architecture-examples/angularjs/bower_components/angular/angular.js
100755 → 100644
View file @
a2d55d9b
/**
* @license AngularJS v1.2.
5
* @license AngularJS v1.2.
6
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
...
...
@@ -68,7 +68,7 @@ function minErr(module) {
return
match
;
});
message
=
message
+
'
\n
http://errors.angularjs.org/1.2.
5
/
'
+
message
=
message
+
'
\n
http://errors.angularjs.org/1.2.
6
/
'
+
(
module
?
module
+
'
/
'
:
''
)
+
code
;
for
(
i
=
2
;
i
<
arguments
.
length
;
i
++
)
{
message
=
message
+
(
i
==
2
?
'
?
'
:
'
&
'
)
+
'
p
'
+
(
i
-
2
)
+
'
=
'
+
...
...
@@ -292,7 +292,9 @@ function forEach(obj, iterator, context) {
if
(
obj
)
{
if
(
isFunction
(
obj
)){
for
(
key
in
obj
)
{
if
(
key
!=
'
prototype
'
&&
key
!=
'
length
'
&&
key
!=
'
name
'
&&
obj
.
hasOwnProperty
(
key
))
{
// Need to check if hasOwnProperty exists,
// as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function
if
(
key
!=
'
prototype
'
&&
key
!=
'
length
'
&&
key
!=
'
name
'
&&
(
!
obj
.
hasOwnProperty
||
obj
.
hasOwnProperty
(
key
)))
{
iterator
.
call
(
context
,
obj
[
key
],
key
);
}
}
...
...
@@ -848,7 +850,7 @@ function shallowCopy(src, dst) {
for
(
var
key
in
src
)
{
// shallowCopy is only ever called by $compile nodeLinkFn, which has control over src
// so we don't need to worry about using our custom hasOwnProperty here
if
(
src
.
hasOwnProperty
(
key
)
&&
key
.
substr
(
0
,
2
)
!==
'
$
$
'
)
{
if
(
src
.
hasOwnProperty
(
key
)
&&
key
.
charAt
(
0
)
!==
'
$
'
&&
key
.
charAt
(
1
)
!==
'
$
'
)
{
dst
[
key
]
=
src
[
key
];
}
}
...
...
@@ -1829,11 +1831,11 @@ function setupModuleLoader(window) {
* - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
*/
var
version
=
{
full
:
'
1.2.
5
'
,
// all of these placeholder strings will be replaced by grunt's
full
:
'
1.2.
6
'
,
// all of these placeholder strings will be replaced by grunt's
major
:
1
,
// package task
minor
:
2
,
dot
:
5
,
codeName
:
'
singularity-expans
ion
'
dot
:
6
,
codeName
:
'
taco-salsaficat
ion
'
};
...
...
@@ -2009,6 +2011,7 @@ function publishExternalAPI(angular){
* - [`next()`](http://api.jquery.com/next/) - Does not support selectors
* - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData
* - [`off()`](http://api.jquery.com/off/) - Does not support namespaces or selectors
* - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors
* - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors
* - [`prepend()`](http://api.jquery.com/prepend/)
* - [`prop()`](http://api.jquery.com/prop/)
...
...
@@ -2600,7 +2603,10 @@ function createEventHandler(element, events) {
return
event
.
defaultPrevented
||
event
.
returnValue
===
false
;
};
forEach
(
events
[
type
||
event
.
type
],
function
(
fn
)
{
// Copy event handlers in case event handlers array is modified during execution.
var
eventHandlersCopy
=
shallowCopy
(
events
[
type
||
event
.
type
]
||
[]);
forEach
(
eventHandlersCopy
,
function
(
fn
)
{
fn
.
call
(
element
,
event
);
});
...
...
@@ -2696,6 +2702,19 @@ forEach({
off
:
jqLiteOff
,
one
:
function
(
element
,
type
,
fn
)
{
element
=
jqLite
(
element
);
//add the listener twice so that when it is called
//you can remove the original function and still be
//able to call element.off(ev, fn) normally
element
.
on
(
type
,
function
onFn
()
{
element
.
off
(
type
,
fn
);
element
.
off
(
type
,
onFn
);
});
element
.
on
(
type
,
fn
);
},
replaceWith
:
function
(
element
,
replaceNode
)
{
var
index
,
parent
=
element
.
parentNode
;
jqLiteDealoc
(
element
);
...
...
@@ -3389,15 +3408,15 @@ function annotate(fn) {
* {@link AUTO.$provide#methods_service $provide.service(class)} that is defined as a CoffeeScript class.
* <pre>
* class Ping
* constructor: (@$http)->
* send: ()=>
* constructor: (@$http)
->
* send: ()
=>
* @$http.get('/ping')
*
* $provide.service('ping', ['$http', Ping])
* </pre>
* You would then inject and use this service like this:
* <pre>
* someModule.controller 'Ctrl', ['ping', (ping)->
* someModule.controller 'Ctrl', ['ping', (ping)
->
* ping.send()
* ]
* </pre>
...
...
@@ -3864,6 +3883,28 @@ var $AnimateProvider = ['$provide', function($provide) {
$provide
.
factory
(
key
,
factory
);
};
/**
* @ngdoc function
* @name ng.$animateProvider#classNameFilter
* @methodOf ng.$animateProvider
*
* @description
* Sets and/or returns the CSS class regular expression that is checked when performing
* an animation. Upon bootstrap the classNameFilter value is not set at all and will
* therefore enable $animate to attempt to perform an animation on any element.
* When setting the classNameFilter value, animations will only be performed on elements
* that successfully match the filter expression. This in turn can boost performance
* for low-powered devices as well as applications containing a lot of structural operations.
* @param {RegExp=} expression The className expression which will be checked against all animations
* @return {RegExp} The current CSS className expression value. If null then there is no expression value
*/
this
.
classNameFilter
=
function
(
expression
)
{
if
(
arguments
.
length
===
1
)
{
this
.
$$classNameFilter
=
(
expression
instanceof
RegExp
)
?
expression
:
null
;
}
return
this
.
$$classNameFilter
;
};
this
.
$get
=
[
'
$timeout
'
,
function
(
$timeout
)
{
/**
...
...
@@ -5111,14 +5152,14 @@ function $TemplateCacheProvider() {
* example would not point to the clone, but rather to the original template that was cloned. In
* this case, you can access the clone via the cloneAttachFn:
* <pre>
* var template
HTML
= angular.element('<p>{{total}}</p>'),
* var template
Element
= angular.element('<p>{{total}}</p>'),
* scope = ....;
*
* var clonedElement = $compile(template
HTML
)(scope, function(clonedElement, scope) {
* var clonedElement = $compile(template
Element
)(scope, function(clonedElement, scope) {
* //attach the clone to DOM document at the right place
* });
*
* //now we have reference to the cloned DOM via `clone`
* //now we have reference to the cloned DOM via `clone
dElement
`
* </pre>
*
*
...
...
@@ -5460,6 +5501,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
var
compositeLinkFn
=
compileNodes
(
$compileNodes
,
transcludeFn
,
$compileNodes
,
maxPriority
,
ignoreDirective
,
previousCompileContext
);
safeAddClass
(
$compileNodes
,
'
ng-scope
'
);
return
function
publicLinkFn
(
scope
,
cloneConnectFn
,
transcludeControllers
){
assertArg
(
scope
,
'
scope
'
);
// important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart
...
...
@@ -5474,12 +5516,13 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
// Attach scope only to non-text nodes.
for
(
var
i
=
0
,
ii
=
$linkNode
.
length
;
i
<
ii
;
i
++
)
{
var
node
=
$linkNode
[
i
];
if
(
node
.
nodeType
==
1
/* element */
||
node
.
nodeType
==
9
/* document */
)
{
var
node
=
$linkNode
[
i
],
nodeType
=
node
.
nodeType
;
if
(
nodeType
===
1
/* element */
||
nodeType
===
9
/* document */
)
{
$linkNode
.
eq
(
i
).
data
(
'
$scope
'
,
scope
);
}
}
safeAddClass
(
$linkNode
,
'
ng-scope
'
);
if
(
cloneConnectFn
)
cloneConnectFn
(
$linkNode
,
scope
);
if
(
compositeLinkFn
)
compositeLinkFn
(
scope
,
$linkNode
,
$linkNode
);
return
$linkNode
;
...
...
@@ -5507,15 +5550,15 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
* @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then
* the rootElement must be set the jqLite collection of the compile root. This is
* needed so that the jqLite collection items can be replaced with widgets.
* @param {number=} max
directive priority
* @param {number=} max
Priority Max directive priority.
* @returns {?function} A composite linking function of all of the matched directives or null.
*/
function
compileNodes
(
nodeList
,
transcludeFn
,
$rootElement
,
maxPriority
,
ignoreDirective
,
previousCompileContext
)
{
var
linkFns
=
[],
nodeLinkFn
,
childLinkFn
,
directives
,
attrs
,
linkFnFound
;
attrs
,
directives
,
nodeLinkFn
,
childNodes
,
childLinkFn
,
linkFnFound
;
for
(
var
i
=
0
;
i
<
nodeList
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
nodeList
.
length
;
i
++
)
{
attrs
=
new
Attributes
();
// we must always refer to nodeList[i] since the nodes can be replaced underneath us.
...
...
@@ -5527,16 +5570,19 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
null
,
[],
[],
previousCompileContext
)
:
null
;
if
(
nodeLinkFn
&&
nodeLinkFn
.
scope
)
{
safeAddClass
(
jqLite
(
nodeList
[
i
]),
'
ng-scope
'
);
}
childLinkFn
=
(
nodeLinkFn
&&
nodeLinkFn
.
terminal
||
!
nodeList
[
i
].
childNodes
||
!
nodeList
[
i
].
childNodes
.
length
)
!
(
childNodes
=
nodeList
[
i
].
childNodes
)
||
!
childNodes
.
length
)
?
null
:
compileNodes
(
nodeList
[
i
].
childNodes
,
:
compileNodes
(
childNodes
,
nodeLinkFn
?
nodeLinkFn
.
transclude
:
transcludeFn
);
linkFns
.
push
(
nodeLinkFn
);
linkFns
.
push
(
childLinkFn
);
linkFnFound
=
(
linkFnFound
||
nodeLinkFn
||
childLinkFn
);
linkFns
.
push
(
nodeLinkFn
,
childLinkFn
);
linkFnFound
=
linkFnFound
||
nodeLinkFn
||
childLinkFn
;
//use the previous context only for the first element in the virtual group
previousCompileContext
=
null
;
}
...
...
@@ -5548,9 +5594,10 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
var
nodeLinkFn
,
childLinkFn
,
node
,
$node
,
childScope
,
childTranscludeFn
,
i
,
ii
,
n
;
// copy nodeList so that linking doesn't break due to live list updates.
var
stableNodeList
=
[];
for
(
i
=
0
,
ii
=
nodeList
.
length
;
i
<
ii
;
i
++
)
{
stableNodeList
.
push
(
nodeList
[
i
]);
var
nodeListLength
=
nodeList
.
length
,
stableNodeList
=
new
Array
(
nodeListLength
);
for
(
i
=
0
;
i
<
nodeListLength
;
i
++
)
{
stableNodeList
[
i
]
=
nodeList
[
i
];
}
for
(
i
=
0
,
n
=
0
,
ii
=
linkFns
.
length
;
i
<
ii
;
n
++
)
{
...
...
@@ -5563,7 +5610,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
if
(
nodeLinkFn
.
scope
)
{
childScope
=
scope
.
$new
();
$node
.
data
(
'
$scope
'
,
childScope
);
safeAddClass
(
$node
,
'
ng-scope
'
);
}
else
{
childScope
=
scope
;
}
...
...
@@ -5646,9 +5692,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
nName
=
directiveNormalize
(
name
.
toLowerCase
());
attrsMap
[
nName
]
=
name
;
attrs
[
nName
]
=
value
=
trim
((
msie
&&
name
==
'
href
'
)
?
decodeURIComponent
(
node
.
getAttribute
(
name
,
2
))
:
attr
.
value
);
attrs
[
nName
]
=
value
=
trim
(
attr
.
value
);
if
(
getBooleanAttrName
(
node
,
nName
))
{
attrs
[
nName
]
=
true
;
// presence means true
}
...
...
@@ -8243,6 +8287,14 @@ function $IntervalProvider() {
* In tests you can use {@link ngMock.$interval#methods_flush `$interval.flush(millis)`} to
* move forward by `millis` milliseconds and trigger any functions scheduled to run in that
* time.
*
* <div class="alert alert-warning">
* **Note**: Intervals created by this service must be explicitly destroyed when you are finished
* with them. In particular they are not automatically destroyed when a controller's scope or a
* directive's element are destroyed.
* You should take this into consideration and make sure to always cancel the interval at the
* appropriate moment. See the example below for more details on how and when to do this.
* </div>
*
* @param {function()} fn A function that should be called repeatedly.
* @param {number} delay Number of milliseconds between each function call.
...
...
@@ -8251,6 +8303,95 @@ function $IntervalProvider() {
* @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
* will invoke `fn` within the {@link ng.$rootScope.Scope#methods_$apply $apply} block.
* @returns {promise} A promise which will be notified on each iteration.
*
* @example
<doc:example module="time">
<doc:source>
<script>
function Ctrl2($scope,$interval) {
$scope.format = 'M/d/yy h:mm:ss a';
$scope.blood_1 = 100;
$scope.blood_2 = 120;
var stop;
$scope.fight = function() {
// Don't start a new fight if we are already fighting
if ( angular.isDefined(stop) ) return;
stop = $interval(function() {
if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {
$scope.blood_1 = $scope.blood_1 - 3;
$scope.blood_2 = $scope.blood_2 - 4;
} else {
$scope.stopFight();
}
}, 100);
};
$scope.stopFight = function() {
if (angular.isDefined(stop)) {
$interval.cancel(stop);
stop = undefined;
}
};
$scope.resetFight = function() {
$scope.blood_1 = 100;
$scope.blood_2 = 120;
}
$scope.$on('$destroy', function() {
// Make sure that the interval is destroyed too
$scope.stopFight();
});
}
angular.module('time', [])
// Register the 'myCurrentTime' directive factory method.
// We inject $interval and dateFilter service since the factory method is DI.
.directive('myCurrentTime', function($interval, dateFilter) {
// return the directive link function. (compile function not needed)
return function(scope, element, attrs) {
var format, // date format
stopTime; // so that we can cancel the time updates
// used to update the UI
function updateTime() {
element.text(dateFilter(new Date(), format));
}
// watch the expression, and update the UI on change.
scope.$watch(attrs.myCurrentTime, function(value) {
format = value;
updateTime();
});
stopTime = $interval(updateTime, 1000);
// listen on DOM destroy (removal) event, and cancel the next UI update
// to prevent updating time ofter the DOM element was removed.
element.bind('$destroy', function() {
$interval.cancel(stopTime);
});
}
});
</script>
<div>
<div ng-controller="Ctrl2">
Date format: <input ng-model="format"> <hr/>
Current time is: <span my-current-time="format"></span>
<hr/>
Blood 1 : <font color='red'>{{blood_1}}</font>
Blood 2 : <font color='red'>{{blood_2}}</font>
<button type="button" data-ng-click="fight()">Fight</button>
<button type="button" data-ng-click="stopFight()">StopFight</button>
<button type="button" data-ng-click="resetFight()">resetFight</button>
</div>
</div>
</doc:source>
</doc:example>
*/
function
interval
(
fn
,
delay
,
count
,
invokeApply
)
{
var
setInterval
=
$window
.
setInterval
,
...
...
@@ -9009,6 +9150,13 @@ function $LocationProvider(){
}
var
absHref
=
elm
.
prop
(
'
href
'
);
if
(
isObject
(
absHref
)
&&
absHref
.
toString
()
===
'
[object SVGAnimatedString]
'
)
{
// SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during
// an animation.
absHref
=
urlResolve
(
absHref
.
animVal
).
href
;
}
var
rewrittenUrl
=
$location
.
$$rewrite
(
absHref
);
if
(
absHref
&&
!
elm
.
attr
(
'
target
'
)
&&
rewrittenUrl
&&
!
event
.
isDefaultPrevented
())
{
...
...
@@ -9217,9 +9365,16 @@ function $LogProvider(){
function
consoleLog
(
type
)
{
var
console
=
$window
.
console
||
{},
logFn
=
console
[
type
]
||
console
.
log
||
noop
;
logFn
=
console
[
type
]
||
console
.
log
||
noop
,
hasApply
=
false
;
// Note: reading logFn.apply throws an error in IE11 in IE8 document mode.
// The reason behind this is that console.log has type "object" in IE8...
try
{
hasApply
=
!!
logFn
.
apply
;
}
catch
(
e
)
{}
if
(
logFn
.
a
pply
)
{
if
(
hasA
pply
)
{
return
function
()
{
var
args
=
[];
forEach
(
arguments
,
function
(
arg
)
{
...
...
@@ -10129,19 +10284,19 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
?
function
cspSafeGetter
(
scope
,
locals
)
{
var
pathVal
=
(
locals
&&
locals
.
hasOwnProperty
(
key0
))
?
locals
:
scope
;
if
(
pathVal
==
=
null
||
pathVal
===
undefined
)
return
pathVal
;
if
(
pathVal
==
null
)
return
pathVal
;
pathVal
=
pathVal
[
key0
];
if
(
!
key1
||
pathVal
===
null
||
pathVal
===
undefined
)
return
pathVal
;
if
(
pathVal
==
null
)
return
key1
?
undefined
:
pathVal
;
pathVal
=
pathVal
[
key1
];
if
(
!
key2
||
pathVal
===
null
||
pathVal
===
undefined
)
return
pathVal
;
if
(
pathVal
==
null
)
return
key2
?
undefined
:
pathVal
;
pathVal
=
pathVal
[
key2
];
if
(
!
key3
||
pathVal
===
null
||
pathVal
===
undefined
)
return
pathVal
;
if
(
pathVal
==
null
)
return
key3
?
undefined
:
pathVal
;
pathVal
=
pathVal
[
key3
];
if
(
!
key4
||
pathVal
===
null
||
pathVal
===
undefined
)
return
pathVal
;
if
(
pathVal
==
null
)
return
key4
?
undefined
:
pathVal
;
pathVal
=
pathVal
[
key4
];
return
pathVal
;
...
...
@@ -10150,7 +10305,7 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
var
pathVal
=
(
locals
&&
locals
.
hasOwnProperty
(
key0
))
?
locals
:
scope
,
promise
;
if
(
pathVal
==
=
null
||
pathVal
===
undefined
)
return
pathVal
;
if
(
pathVal
==
null
)
return
pathVal
;
pathVal
=
pathVal
[
key0
];
if
(
pathVal
&&
pathVal
.
then
)
{
...
...
@@ -10162,7 +10317,7 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
}
pathVal
=
pathVal
.
$$v
;
}
if
(
!
key1
||
pathVal
===
null
||
pathVal
===
undefined
)
return
pathVal
;
if
(
pathVal
==
null
)
return
key1
?
undefined
:
pathVal
;
pathVal
=
pathVal
[
key1
];
if
(
pathVal
&&
pathVal
.
then
)
{
...
...
@@ -10174,7 +10329,7 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
}
pathVal
=
pathVal
.
$$v
;
}
if
(
!
key2
||
pathVal
===
null
||
pathVal
===
undefined
)
return
pathVal
;
if
(
pathVal
==
null
)
return
key2
?
undefined
:
pathVal
;
pathVal
=
pathVal
[
key2
];
if
(
pathVal
&&
pathVal
.
then
)
{
...
...
@@ -10186,7 +10341,7 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
}
pathVal
=
pathVal
.
$$v
;
}
if
(
!
key3
||
pathVal
===
null
||
pathVal
===
undefined
)
return
pathVal
;
if
(
pathVal
==
null
)
return
key3
?
undefined
:
pathVal
;
pathVal
=
pathVal
[
key3
];
if
(
pathVal
&&
pathVal
.
then
)
{
...
...
@@ -10198,7 +10353,7 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
}
pathVal
=
pathVal
.
$$v
;
}
if
(
!
key4
||
pathVal
===
null
||
pathVal
===
undefined
)
return
pathVal
;
if
(
pathVal
==
null
)
return
key4
?
undefined
:
pathVal
;
pathVal
=
pathVal
[
key4
];
if
(
pathVal
&&
pathVal
.
then
)
{
...
...
@@ -10214,6 +10369,26 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
};
}
function
simpleGetterFn1
(
key0
,
fullExp
)
{
ensureSafeMemberName
(
key0
,
fullExp
);
return
function
simpleGetterFn1
(
scope
,
locals
)
{
if
(
scope
==
null
)
return
undefined
;
return
((
locals
&&
locals
.
hasOwnProperty
(
key0
))
?
locals
:
scope
)[
key0
];
};
}
function
simpleGetterFn2
(
key0
,
key1
,
fullExp
)
{
ensureSafeMemberName
(
key0
,
fullExp
);
ensureSafeMemberName
(
key1
,
fullExp
);
return
function
simpleGetterFn2
(
scope
,
locals
)
{
if
(
scope
==
null
)
return
undefined
;
scope
=
((
locals
&&
locals
.
hasOwnProperty
(
key0
))
?
locals
:
scope
)[
key0
];
return
scope
==
null
?
undefined
:
scope
[
key1
];
};
}
function
getterFn
(
path
,
options
,
fullExp
)
{
// Check whether the cache has this getter already.
// We can use hasOwnProperty directly on the cache because we ensure,
...
...
@@ -10226,7 +10401,13 @@ function getterFn(path, options, fullExp) {
pathKeysLength
=
pathKeys
.
length
,
fn
;
if
(
options
.
csp
)
{
// When we have only 1 or 2 tokens, use optimized special case closures.
// http://jsperf.com/angularjs-parse-getter/6
if
(
!
options
.
unwrapPromises
&&
pathKeysLength
===
1
)
{
fn
=
simpleGetterFn1
(
pathKeys
[
0
],
fullExp
);
}
else
if
(
!
options
.
unwrapPromises
&&
pathKeysLength
===
2
)
{
fn
=
simpleGetterFn2
(
pathKeys
[
0
],
pathKeys
[
1
],
fullExp
);
}
else
if
(
options
.
csp
)
{
if
(
pathKeysLength
<
6
)
{
fn
=
cspSafeGetterFn
(
pathKeys
[
0
],
pathKeys
[
1
],
pathKeys
[
2
],
pathKeys
[
3
],
pathKeys
[
4
],
fullExp
,
options
);
...
...
@@ -10244,11 +10425,10 @@ function getterFn(path, options, fullExp) {
};
}
}
else
{
var
code
=
'
var
l, fn,
p;
\n
'
;
var
code
=
'
var p;
\n
'
;
forEach
(
pathKeys
,
function
(
key
,
index
)
{
ensureSafeMemberName
(
key
,
fullExp
);
code
+=
'
if(s === null || s === undefined) return s;
\n
'
+
'
l=s;
\n
'
+
code
+=
'
if(s == null) return undefined;
\n
'
+
'
s=
'
+
(
index
// we simply dereference 's' on any .dot notation
?
'
s
'
...
...
@@ -10271,10 +10451,10 @@ function getterFn(path, options, fullExp) {
/* jshint -W054 */
var
evaledFnGetter
=
new
Function
(
'
s
'
,
'
k
'
,
'
pw
'
,
code
);
// s=scope, k=locals, pw=promiseWarning
/* jshint +W054 */
evaledFnGetter
.
toString
=
function
()
{
return
code
;
}
;
fn
=
function
(
scope
,
locals
)
{
evaledFnGetter
.
toString
=
valueFn
(
code
)
;
fn
=
options
.
unwrapPromises
?
function
(
scope
,
locals
)
{
return
evaledFnGetter
(
scope
,
locals
,
promiseWarning
);
};
}
:
evaledFnGetter
;
}
// Only cache the value if it's not going to mess up the cache object
...
...
@@ -13285,6 +13465,7 @@ function $SnifferProvider() {
vendorPrefix
:
vendorPrefix
,
transitions
:
transitions
,
animations
:
animations
,
android
:
android
,
msie
:
msie
,
msieDocumentMode
:
documentMode
};
...
...
@@ -13322,93 +13503,6 @@ function $TimeoutProvider() {
* @returns {Promise} Promise that will be resolved when the timeout is reached. The value this
* promise will be resolved with is the return value of the `fn` function.
*
* @example
<doc:example module="time">
<doc:source>
<script>
function Ctrl2($scope,$timeout) {
$scope.format = 'M/d/yy h:mm:ss a';
$scope.blood_1 = 100;
$scope.blood_2 = 120;
var stop;
$scope.fight = function() {
stop = $timeout(function() {
if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {
$scope.blood_1 = $scope.blood_1 - 3;
$scope.blood_2 = $scope.blood_2 - 4;
$scope.fight();
} else {
$timeout.cancel(stop);
}
}, 100);
};
$scope.stopFight = function() {
$timeout.cancel(stop);
};
$scope.resetFight = function() {
$scope.blood_1 = 100;
$scope.blood_2 = 120;
}
}
angular.module('time', [])
// Register the 'myCurrentTime' directive factory method.
// We inject $timeout and dateFilter service since the factory method is DI.
.directive('myCurrentTime', function($timeout, dateFilter) {
// return the directive link function. (compile function not needed)
return function(scope, element, attrs) {
var format, // date format
timeoutId; // timeoutId, so that we can cancel the time updates
// used to update the UI
function updateTime() {
element.text(dateFilter(new Date(), format));
}
// watch the expression, and update the UI on change.
scope.$watch(attrs.myCurrentTime, function(value) {
format = value;
updateTime();
});
// schedule update in one second
function updateLater() {
// save the timeoutId for canceling
timeoutId = $timeout(function() {
updateTime(); // update DOM
updateLater(); // schedule another update
}, 1000);
}
// listen on DOM destroy (removal) event, and cancel the next UI update
// to prevent updating time ofter the DOM element was removed.
element.bind('$destroy', function() {
$timeout.cancel(timeoutId);
});
updateLater(); // kick off the UI update process.
}
});
</script>
<div>
<div ng-controller="Ctrl2">
Date format: <input ng-model="format"> <hr/>
Current time is: <span my-current-time="format"></span>
<hr/>
Blood 1 : <font color='red'>{{blood_1}}</font>
Blood 2 : <font color='red'>{{blood_2}}</font>
<button type="button" data-ng-click="fight()">Fight</button>
<button type="button" data-ng-click="stopFight()">StopFight</button>
<button type="button" data-ng-click="resetFight()">resetFight</button>
</div>
</div>
</doc:source>
</doc:example>
*/
function
timeout
(
fn
,
delay
,
invokeApply
)
{
var
deferred
=
$q
.
defer
(),
...
...
@@ -14720,6 +14814,7 @@ var htmlAnchorDirective = valueFn({
* @ngdoc directive
* @name ng.directive:ngHref
* @restrict A
* @priority 99
*
* @description
* Using Angular markup like `{{hash}}` in an href attribute will
...
...
@@ -14803,6 +14898,7 @@ var htmlAnchorDirective = valueFn({
* @ngdoc directive
* @name ng.directive:ngSrc
* @restrict A
* @priority 99
*
* @description
* Using Angular markup like `{{hash}}` in a `src` attribute doesn't
...
...
@@ -14828,6 +14924,7 @@ var htmlAnchorDirective = valueFn({
* @ngdoc directive
* @name ng.directive:ngSrcset
* @restrict A
* @priority 99
*
* @description
* Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't
...
...
@@ -14853,6 +14950,7 @@ var htmlAnchorDirective = valueFn({
* @ngdoc directive
* @name ng.directive:ngDisabled
* @restrict A
* @priority 100
*
* @description
*
...
...
@@ -14896,6 +14994,7 @@ var htmlAnchorDirective = valueFn({
* @ngdoc directive
* @name ng.directive:ngChecked
* @restrict A
* @priority 100
*
* @description
* The HTML specification does not require browsers to preserve the values of boolean attributes
...
...
@@ -14930,6 +15029,7 @@ var htmlAnchorDirective = valueFn({
* @ngdoc directive
* @name ng.directive:ngReadonly
* @restrict A
* @priority 100
*
* @description
* The HTML specification does not require browsers to preserve the values of boolean attributes
...
...
@@ -14939,7 +15039,6 @@ var htmlAnchorDirective = valueFn({
* The `ngReadonly` directive solves this problem for the `readonly` attribute.
* This complementary directive is not removed by the browser and so provides
* a permanent reliable place to store the binding information.
* @example
<doc:example>
<doc:source>
...
...
@@ -14965,6 +15064,7 @@ var htmlAnchorDirective = valueFn({
* @ngdoc directive
* @name ng.directive:ngSelected
* @restrict A
* @priority 100
*
* @description
* The HTML specification does not require browsers to preserve the values of boolean attributes
...
...
@@ -14974,6 +15074,7 @@ var htmlAnchorDirective = valueFn({
* The `ngSelected` directive solves this problem for the `selected` atttribute.
* This complementary directive is not removed by the browser and so provides
* a permanent reliable place to store the binding information.
*
* @example
<doc:example>
<doc:source>
...
...
@@ -15001,6 +15102,7 @@ var htmlAnchorDirective = valueFn({
* @ngdoc directive
* @name ng.directive:ngOpen
* @restrict A
* @priority 100
*
* @description
* The HTML specification does not require browsers to preserve the values of boolean attributes
...
...
@@ -15010,8 +15112,6 @@ var htmlAnchorDirective = valueFn({
* The `ngOpen` directive solves this problem for the `open` attribute.
* This complementary directive is not removed by the browser and so provides
* a permanent reliable place to store the binding information.
*
* @example
<doc:example>
<doc:source>
...
...
@@ -15856,15 +15956,17 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
// In composition mode, users are still inputing intermediate text buffer,
// hold the listener until composition is done.
// More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent
var
composing
=
false
;
if
(
!
$sniffer
.
android
)
{
var
composing
=
false
;
element
.
on
(
'
compositionstart
'
,
function
(
)
{
composing
=
true
;
});
element
.
on
(
'
compositionstart
'
,
function
(
data
)
{
composing
=
true
;
});
element
.
on
(
'
compositionend
'
,
function
()
{
composing
=
false
;
});
element
.
on
(
'
compositionend
'
,
function
()
{
composing
=
false
;
});
}
var
listener
=
function
()
{
if
(
composing
)
return
;
...
...
@@ -17429,7 +17531,7 @@ var ngClassEvenDirective = classDirective('Even', 1);
*
* Legacy browsers, like IE7, do not provide attribute selector support (added in CSS 2.1) so they
* cannot match the `[ng\:cloak]` selector. To work around this limitation, you must add the css
* class `ng
C
loak` in addition to the `ngCloak` directive as shown in the example below.
* class `ng
-c
loak` in addition to the `ngCloak` directive as shown in the example below.
*
* @element ANY
*
...
...
@@ -17740,7 +17842,14 @@ forEach(
* a dblclick. (The Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
<doc:example>
<doc:source>
<button ng-dblclick="count = count + 1" ng-init="count=0">
Increment (on double click)
</button>
count: {{count}}
</doc:source>
</doc:example>
*/
...
...
@@ -17756,7 +17865,14 @@ forEach(
* mousedown. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
<doc:example>
<doc:source>
<button ng-mousedown="count = count + 1" ng-init="count=0">
Increment (on mouse down)
</button>
count: {{count}}
</doc:source>
</doc:example>
*/
...
...
@@ -17772,7 +17888,14 @@ forEach(
* mouseup. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
<doc:example>
<doc:source>
<button ng-mouseup="count = count + 1" ng-init="count=0">
Increment (on mouse up)
</button>
count: {{count}}
</doc:source>
</doc:example>
*/
/**
...
...
@@ -17787,7 +17910,14 @@ forEach(
* mouseover. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
<doc:example>
<doc:source>
<button ng-mouseover="count = count + 1" ng-init="count=0">
Increment (when mouse is over)
</button>
count: {{count}}
</doc:source>
</doc:example>
*/
...
...
@@ -17803,7 +17933,14 @@ forEach(
* mouseenter. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
<doc:example>
<doc:source>
<button ng-mouseenter="count = count + 1" ng-init="count=0">
Increment (when mouse enters)
</button>
count: {{count}}
</doc:source>
</doc:example>
*/
...
...
@@ -17819,7 +17956,14 @@ forEach(
* mouseleave. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
<doc:example>
<doc:source>
<button ng-mouseleave="count = count + 1" ng-init="count=0">
Increment (when mouse leaves)
</button>
count: {{count}}
</doc:source>
</doc:example>
*/
...
...
@@ -17835,7 +17979,14 @@ forEach(
* mousemove. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
<doc:example>
<doc:source>
<button ng-mousemove="count = count + 1" ng-init="count=0">
Increment (when mouse moves)
</button>
count: {{count}}
</doc:source>
</doc:example>
*/
...
...
@@ -17851,7 +18002,12 @@ forEach(
* keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
*
* @example
* See {@link ng.directive:ngClick ngClick}
<doc:example>
<doc:source>
<input ng-keydown="count = count + 1" ng-init="count=0">
key down count: {{count}}
</doc:source>
</doc:example>
*/
...
...
@@ -17867,7 +18023,12 @@ forEach(
* keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
*
* @example
* See {@link ng.directive:ngClick ngClick}
<doc:example>
<doc:source>
<input ng-keyup="count = count + 1" ng-init="count=0">
key up count: {{count}}
</doc:source>
</doc:example>
*/
...
...
@@ -17883,7 +18044,12 @@ forEach(
* keypress. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
*
* @example
* See {@link ng.directive:ngClick ngClick}
<doc:example>
<doc:source>
<input ng-keypress="count = count + 1" ng-init="count=0">
key press count: {{count}}
</doc:source>
</doc:example>
*/
...
...
@@ -17982,7 +18148,12 @@ forEach(
* copy. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
<doc:example>
<doc:source>
<input ng-copy="copied=true" ng-init="copied=false; value='copy me'" ng-model="value">
copied: {{copied}}
</doc:source>
</doc:example>
*/
/**
...
...
@@ -17997,7 +18168,12 @@ forEach(
* cut. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
<doc:example>
<doc:source>
<input ng-cut="cut=true" ng-init="cut=false; value='cut me'" ng-model="value">
cut: {{cut}}
</doc:source>
</doc:example>
*/
/**
...
...
@@ -18012,7 +18188,12 @@ forEach(
* paste. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
<doc:example>
<doc:source>
<input ng-paste="paste=true" ng-init="paste=false" placeholder='paste here'>
pasted: {{paste}}
</doc:source>
</doc:example>
*/
/**
...
...
@@ -18074,9 +18255,6 @@ forEach(
padding:10px;
}
/*
The transition styles can also be placed on the CSS base class above
*/
.animate-if.ng-enter, .animate-if.ng-leave {
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
...
...
@@ -18384,7 +18562,7 @@ var ngIncludeFillContentDirective = ['$compile',
* current scope.
*
* <div class="alert alert-error">
* The only appropriate use of `ngInit` for aliasing special properties of
* The only appropriate use of `ngInit`
is
for aliasing special properties of
* {@link api/ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below. Besides this case, you
* should use {@link guide/controller controllers} rather than `ngInit`
* to initialize values on a scope.
...
...
@@ -18883,7 +19061,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
$
$tlb
:
true
,
link
:
function
(
$scope
,
$element
,
$attr
,
ctrl
,
$transclude
){
var
expression
=
$attr
.
ngRepeat
;
var
match
=
expression
.
match
(
/^
\s
*
(
.+
)\s
+in
\s
+
(
.
*
?)\s
*
(\s
+track
\s
+by
\s
+
(
.+
)\s
*
)?
$/
),
var
match
=
expression
.
match
(
/^
\s
*
(
.+
)\s
+in
\s
+
(
[\r\n\s\S]
*
?)\s
*
(\s
+track
\s
+by
\s
+
(
.+
)\s
*
)?
$/
),
trackByExp
,
trackByExpGetter
,
trackByIdExpFn
,
trackByIdArrayFn
,
trackByIdObjFn
,
lhs
,
rhs
,
valueIdentifier
,
keyIdentifier
,
hashFnLocals
=
{
$id
:
hashKey
};
...
...
@@ -19941,18 +20119,10 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
selectCtrl
.
init
(
ngModelCtrl
,
nullOption
,
unknownOption
);
// required validator
if
(
multiple
&&
(
attr
.
required
||
attr
.
ngRequired
))
{
var
requiredValidator
=
function
(
value
)
{
ngModelCtrl
.
$setValidity
(
'
required
'
,
!
attr
.
required
||
(
value
&&
value
.
length
));
return
value
;
if
(
multiple
)
{
ngModelCtrl
.
$isEmpty
=
function
(
value
)
{
return
!
value
||
value
.
length
===
0
;
};
ngModelCtrl
.
$parsers
.
push
(
requiredValidator
);
ngModelCtrl
.
$formatters
.
unshift
(
requiredValidator
);
attr
.
$observe
(
'
required
'
,
function
()
{
requiredValidator
(
ngModelCtrl
.
$viewValue
);
});
}
if
(
optionsExp
)
setupAsOptions
(
scope
,
element
,
ngModelCtrl
);
...
...
@@ -20366,4 +20536,4 @@ var styleDirective = valueFn({
})(
window
,
document
);
!
angular
.
$$csp
()
&&
angular
.
element
(
document
).
find
(
'
head
'
).
prepend
(
'
<style type="text/css">@charset "UTF-8";[ng
\\
:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng
\\
:form{display:block;}.ng-animate-start{border-spacing:1px 1px;-ms-zoom:1.0001;}.ng-animate-active{border-spacing:0px 0px;-ms-zoom:1;}</style>
'
);
\ No newline at end of file
!
angular
.
$$csp
()
&&
angular
.
element
(
document
).
find
(
'
head
'
).
prepend
(
'
<style type="text/css">@charset "UTF-8";[ng
\\
:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng
\\
:form{display:block;}</style>
'
);
\ No newline at end of file
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