diff options
| author | Misko Hevery | 2011-02-04 16:42:21 -0800 |
|---|---|---|
| committer | Misko Hevery | 2011-02-16 00:48:22 -0500 |
| commit | a004d487c4bb48b2bec19b60bc5ddc5244029be5 (patch) | |
| tree | 48fe97cf0c79dc7126e7bfc5a40441738cb8dbab /src/Angular.js | |
| parent | 037f30a0c9f819aedf47f0da782e8d1fec0d6489 (diff) | |
| download | angular.js-a004d487c4bb48b2bec19b60bc5ddc5244029be5.tar.bz2 | |
allow jquery to be declared after angular in the script loading order
Diffstat (limited to 'src/Angular.js')
| -rw-r--r-- | src/Angular.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Angular.js b/src/Angular.js index 4187e9ad..b856aa24 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -83,17 +83,16 @@ var _undefined = undefined, PRIORITY_LAST = 99999, PRIORITY = {'FIRST': PRIORITY_FIRST, 'LAST': PRIORITY_LAST, 'WATCH':PRIORITY_WATCH}, Error = window.Error, - jQuery = window['jQuery'] || window['$'], // weirdness to make IE happy - _ = window['_'], /** holds major version number for IE or NaN for real browsers */ msie = parseInt((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1], 10), - jqLite = jQuery || jqLiteWrap, + jqLite, // delay binding since jQuery could be loaded after us. + jQuery, // delay binding slice = Array.prototype.slice, push = Array.prototype.push, error = window[$console] ? bind(window[$console], window[$console]['error'] || noop) : noop, /** @name angular */ - angular = window[$angular] || (window[$angular] = {}), + angular = window[$angular] || (window[$angular] = {}), /** @name angular.markup */ angularTextMarkup = extensionMap(angular, 'markup'), /** @name angular.attrMarkup */ @@ -1006,6 +1005,7 @@ function angularInit(config){ } function angularJsConfig(document, config) { + bindJQuery(); var scripts = document.getElementsByTagName("script"), match; config = extend({ @@ -1028,3 +1028,9 @@ function angularJsConfig(document, config) { } return config; } + +function bindJQuery(){ + // bind to jQuery if present; + jQuery = window.jQuery; + angular.element = jqLite = jQuery || jqLiteWrap; +} |
