From 85f13d602e31424b2e2d18172872f14a24c31135 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 1 Apr 2010 14:10:28 -0700 Subject: work on $location and autobind --- src/Angular.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/Angular.js') diff --git a/src/Angular.js b/src/Angular.js index 72ff26b0..5b5aa87b 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -45,7 +45,7 @@ UrlWatcher.prototype = { } }; - +//////////////////////////////////// if (typeof document.getAttribute == 'undefined') document.getAttribute = function() {}; @@ -386,3 +386,20 @@ function compile(element, config) { } ///////////////////////////////////////////////// +function parseKeyValue(keyValue) { + var obj = {}, key_value, key; + foreach((keyValue || "").split('&'), function(keyValue){ + if (keyValue) { + key_value = keyValue.split('='); + key = decodeURIComponent(key_value[0]); + obj[key] = key_value[1] ? decodeURIComponent(key_value[1]) : true; + } + }); + return obj; +} + +function angularInit(config){ + if (config.autobind) { + compile(window.document, config).$init(); + } +} -- cgit v1.2.3