mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-09 15:24:43 +00:00
browser is now injectable into the system
This commit is contained in:
parent
a80a61839a
commit
5dcf9bb4fe
6 changed files with 22 additions and 21 deletions
|
|
@ -33,22 +33,6 @@ function angularAlert(){
|
||||||
log(arguments); window.alert.apply(window, arguments);
|
log(arguments); window.alert.apply(window, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
extend(angular, {
|
|
||||||
'compile': compile,
|
|
||||||
'copy': copy,
|
|
||||||
'extend': extend,
|
|
||||||
'foreach': foreach,
|
|
||||||
'noop':noop,
|
|
||||||
'identity':identity,
|
|
||||||
'isUndefined': isUndefined,
|
|
||||||
'isDefined': isDefined,
|
|
||||||
'isString': isString,
|
|
||||||
'isFunction': isFunction,
|
|
||||||
'isNumber': isNumber,
|
|
||||||
'isArray': isArray,
|
|
||||||
'alert': angularAlert
|
|
||||||
});
|
|
||||||
|
|
||||||
function foreach(obj, iterator, context) {
|
function foreach(obj, iterator, context) {
|
||||||
var key;
|
var key;
|
||||||
if (obj) {
|
if (obj) {
|
||||||
|
|
|
||||||
17
src/AngularPublic.js
Normal file
17
src/AngularPublic.js
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
extend(angular, {
|
||||||
|
'element': jqLite,
|
||||||
|
'compile': compile,
|
||||||
|
'scope': createScope,
|
||||||
|
'copy': copy,
|
||||||
|
'extend': extend,
|
||||||
|
'foreach': foreach,
|
||||||
|
'noop':noop,
|
||||||
|
'identity':identity,
|
||||||
|
'isUndefined': isUndefined,
|
||||||
|
'isDefined': isDefined,
|
||||||
|
'isString': isString,
|
||||||
|
'isFunction': isFunction,
|
||||||
|
'isNumber': isNumber,
|
||||||
|
'isArray': isArray
|
||||||
|
});
|
||||||
|
|
||||||
|
|
@ -37,7 +37,6 @@ Browser.prototype = {
|
||||||
existingURL += '#';
|
existingURL += '#';
|
||||||
if (existingURL != url)
|
if (existingURL != url)
|
||||||
this.location.href = url;
|
this.location.href = url;
|
||||||
this.existingURL = url;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getUrl: function() {
|
getUrl: function() {
|
||||||
|
|
|
||||||
1
src/angular-bootstrap.js
vendored
1
src/angular-bootstrap.js
vendored
|
|
@ -47,6 +47,7 @@
|
||||||
addScript("/Parser.js");
|
addScript("/Parser.js");
|
||||||
addScript("/Resource.js");
|
addScript("/Resource.js");
|
||||||
addScript("/Browser.js");
|
addScript("/Browser.js");
|
||||||
|
addScript("/AngularPublic.js");
|
||||||
|
|
||||||
// Extension points
|
// Extension points
|
||||||
addScript("/apis.js");
|
addScript("/apis.js");
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,9 @@ angularService("$location", function(browser){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var hashKeyValue = toKeyValue(location.hashSearch);
|
var hashKeyValue = toKeyValue(location.hashSearch);
|
||||||
return location.href +
|
var hash = (location.hashPath ? location.hashPath : '') +
|
||||||
(location.hashPath ? location.hashPath : '') +
|
|
||||||
(hashKeyValue ? '?' + hashKeyValue : '');
|
(hashKeyValue ? '?' + hashKeyValue : '');
|
||||||
|
return location.href.split('#')[0] + '#' + (hash ? hash : '');
|
||||||
}
|
}
|
||||||
browser.watchUrl(function(url){
|
browser.watchUrl(function(url){
|
||||||
location(url);
|
location(url);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ describe("services", function(){
|
||||||
scope.$location.hashPath = 'page=http://path';
|
scope.$location.hashPath = 'page=http://path';
|
||||||
scope.$location.hashSearch = {k:'a=b'};
|
scope.$location.hashSearch = {k:'a=b'};
|
||||||
|
|
||||||
expect(scope.$location()).toEqual('http://host:123/p/a/t/h.html?query=value#path?key=valuepage=http://path?k=a%3Db');
|
expect(scope.$location()).toEqual('http://host:123/p/a/t/h.html?query=value#page=http://path?k=a%3Db');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should parse file://', function(){
|
it('should parse file://', function(){
|
||||||
|
|
@ -39,7 +39,7 @@ describe("services", function(){
|
||||||
expect(scope.$location.hashPath).toEqual('');
|
expect(scope.$location.hashPath).toEqual('');
|
||||||
expect(scope.$location.hashSearch).toEqual({});
|
expect(scope.$location.hashSearch).toEqual({});
|
||||||
|
|
||||||
expect(scope.$location()).toEqual('file:///Users/Shared/misko/work/angular.js/scenario/widgets.html');
|
expect(scope.$location()).toEqual('file:///Users/Shared/misko/work/angular.js/scenario/widgets.html#');
|
||||||
});
|
});
|
||||||
|
|
||||||
xit('should add stylesheets', function(){
|
xit('should add stylesheets', function(){
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue