aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Angular.js40
-rw-r--r--src/angular-bootstrap.js4
-rw-r--r--src/angular.suffix4
3 files changed, 21 insertions, 27 deletions
diff --git a/src/Angular.js b/src/Angular.js
index c5a35e4e..ab031049 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -116,7 +116,6 @@ var _undefined = undefined,
angularService = extensionMap(angular, 'service'),
angularCallbacks = extensionMap(angular, 'callbacks'),
nodeName_,
- rngScript = /^(|.*\/)angular(-.*?)?(\.min)?.js(\?[^#]*)?(#(.*))?$/,
uid = ['0', '0', '0'],
DATE_ISOSTRING_LN = 24;
@@ -953,35 +952,30 @@ function angularInit(config, document){
var autobind = config.autobind;
if (autobind) {
- var element = isString(autobind) ? document.getElementById(autobind) : document,
- scope = compile(element)(createScope()),
- $browser = scope.$service('$browser');
-
- if (config.css)
- $browser.addCss(config.base_url + config.css);
- scope.$apply();
+ var element = isString(autobind) ? document.getElementById(autobind) : document;
+ compile(element)().$apply();
}
}
function angularJsConfig(document) {
bindJQuery();
- var scripts = document.getElementsByTagName("script"),
+ var scripts = document.getElementsByTagName('script'),
+ script = scripts[scripts.length-1],
+ scriptSrc = script.src,
config = {},
- match;
- for(var j = 0; j < scripts.length; j++) {
- match = (scripts[j].src || "").match(rngScript);
- if (match) {
- config.base_url = match[1];
- extend(config, parseKeyValue(match[6]));
- eachAttribute(jqLite(scripts[j]), function(value, name){
- if (/^ng:/.exec(name)) {
- name = name.substring(3).replace(/-/g, '_');
- value = value || true;
- config[name] = value;
- }
- });
+ hashPos;
+
+ hashPos = scriptSrc.indexOf('#');
+ if (hashPos != -1) extend(config, parseKeyValue(scriptSrc.substr(hashPos+1)));
+
+ eachAttribute(jqLite(script), function(value, name){
+ if (/^ng:/.exec(name)) {
+ name = name.substring(3).replace(/-/g, '_');
+ value = value || true;
+ config[name] = value;
}
- }
+ });
+
return config;
}
diff --git a/src/angular-bootstrap.js b/src/angular-bootstrap.js
index 7a1752d2..fb2acbeb 100644
--- a/src/angular-bootstrap.js
+++ b/src/angular-bootstrap.js
@@ -99,9 +99,7 @@
// empty the cache to prevent mem leaks
globalVars = {};
- var config = angularJsConfig(document);
-
- angularInit(config, document);
+ angularInit({autobind:true}, document);
}
if (window.addEventListener) {
diff --git a/src/angular.suffix b/src/angular.suffix
index e8bb83b7..d38d3130 100644
--- a/src/angular.suffix
+++ b/src/angular.suffix
@@ -1,6 +1,8 @@
+ var config = angularJsConfig(document);
+
jqLiteWrap(document).ready(function() {
- angularInit(angularJsConfig(document), document);
+ angularInit(config, document);
});
})(window, document);