mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-06-13 08:30:36 +08:00
This handy service is designed to download and cache template contents and to throw an error when a template request fails. BREAKING CHANGE Angular will now throw a $compile minErr each a template fails to download for ngView, directives and ngMessage template requests. This changes the former behavior of silently ignoring failed HTTP requests--or when the template itself is empty. Please ensure that all directive, ngView and ngMessage code now properly addresses this scenario. NgInclude is uneffected from this change.
240 lines
6.7 KiB
JavaScript
240 lines
6.7 KiB
JavaScript
'use strict';
|
||
|
||
/* global angularModule: true,
|
||
version: true,
|
||
|
||
$LocaleProvider,
|
||
$CompileProvider,
|
||
|
||
htmlAnchorDirective,
|
||
inputDirective,
|
||
inputDirective,
|
||
formDirective,
|
||
scriptDirective,
|
||
selectDirective,
|
||
styleDirective,
|
||
optionDirective,
|
||
ngBindDirective,
|
||
ngBindHtmlDirective,
|
||
ngBindTemplateDirective,
|
||
ngClassDirective,
|
||
ngClassEvenDirective,
|
||
ngClassOddDirective,
|
||
ngCspDirective,
|
||
ngCloakDirective,
|
||
ngControllerDirective,
|
||
ngFormDirective,
|
||
ngHideDirective,
|
||
ngIfDirective,
|
||
ngIncludeDirective,
|
||
ngIncludeFillContentDirective,
|
||
ngInitDirective,
|
||
ngNonBindableDirective,
|
||
ngPluralizeDirective,
|
||
ngRepeatDirective,
|
||
ngShowDirective,
|
||
ngStyleDirective,
|
||
ngSwitchDirective,
|
||
ngSwitchWhenDirective,
|
||
ngSwitchDefaultDirective,
|
||
ngOptionsDirective,
|
||
ngTranscludeDirective,
|
||
ngModelDirective,
|
||
ngListDirective,
|
||
ngChangeDirective,
|
||
patternDirective,
|
||
patternDirective,
|
||
requiredDirective,
|
||
requiredDirective,
|
||
minlengthDirective,
|
||
minlengthDirective,
|
||
maxlengthDirective,
|
||
maxlengthDirective,
|
||
ngValueDirective,
|
||
ngModelOptionsDirective,
|
||
ngAttributeAliasDirectives,
|
||
ngEventDirectives,
|
||
|
||
$AnchorScrollProvider,
|
||
$AnimateProvider,
|
||
$BrowserProvider,
|
||
$CacheFactoryProvider,
|
||
$ControllerProvider,
|
||
$DocumentProvider,
|
||
$ExceptionHandlerProvider,
|
||
$FilterProvider,
|
||
$InterpolateProvider,
|
||
$IntervalProvider,
|
||
$HttpProvider,
|
||
$HttpBackendProvider,
|
||
$LocationProvider,
|
||
$LogProvider,
|
||
$ParseProvider,
|
||
$RootScopeProvider,
|
||
$QProvider,
|
||
$$QProvider,
|
||
$$SanitizeUriProvider,
|
||
$SceProvider,
|
||
$SceDelegateProvider,
|
||
$SnifferProvider,
|
||
$TemplateCacheProvider,
|
||
$TemplateRequestProvider,
|
||
$TimeoutProvider,
|
||
$$RAFProvider,
|
||
$$AsyncCallbackProvider,
|
||
$WindowProvider
|
||
*/
|
||
|
||
|
||
/**
|
||
* @ngdoc object
|
||
* @name angular.version
|
||
* @module ng
|
||
* @description
|
||
* An object that contains information about the current AngularJS version. This object has the
|
||
* following properties:
|
||
*
|
||
* - `full` – `{string}` – Full version string, such as "0.9.18".
|
||
* - `major` – `{number}` – Major version number, such as "0".
|
||
* - `minor` – `{number}` – Minor version number, such as "9".
|
||
* - `dot` – `{number}` – Dot version number, such as "18".
|
||
* - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
|
||
*/
|
||
var version = {
|
||
full: '"NG_VERSION_FULL"', // all of these placeholder strings will be replaced by grunt's
|
||
major: "NG_VERSION_MAJOR", // package task
|
||
minor: "NG_VERSION_MINOR",
|
||
dot: "NG_VERSION_DOT",
|
||
codeName: '"NG_VERSION_CODENAME"'
|
||
};
|
||
|
||
|
||
function publishExternalAPI(angular){
|
||
extend(angular, {
|
||
'bootstrap': bootstrap,
|
||
'copy': copy,
|
||
'extend': extend,
|
||
'equals': equals,
|
||
'element': jqLite,
|
||
'forEach': forEach,
|
||
'injector': createInjector,
|
||
'noop': noop,
|
||
'bind': bind,
|
||
'toJson': toJson,
|
||
'fromJson': fromJson,
|
||
'identity': identity,
|
||
'isUndefined': isUndefined,
|
||
'isDefined': isDefined,
|
||
'isString': isString,
|
||
'isFunction': isFunction,
|
||
'isObject': isObject,
|
||
'isNumber': isNumber,
|
||
'isElement': isElement,
|
||
'isArray': isArray,
|
||
'version': version,
|
||
'isDate': isDate,
|
||
'lowercase': lowercase,
|
||
'uppercase': uppercase,
|
||
'callbacks': {counter: 0},
|
||
'$$minErr': minErr,
|
||
'$$csp': csp
|
||
});
|
||
|
||
angularModule = setupModuleLoader(window);
|
||
try {
|
||
angularModule('ngLocale');
|
||
} catch (e) {
|
||
angularModule('ngLocale', []).provider('$locale', $LocaleProvider);
|
||
}
|
||
|
||
angularModule('ng', ['ngLocale'], ['$provide',
|
||
function ngModule($provide) {
|
||
// $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
|
||
$provide.provider({
|
||
$$sanitizeUri: $$SanitizeUriProvider
|
||
});
|
||
$provide.provider('$compile', $CompileProvider).
|
||
directive({
|
||
a: htmlAnchorDirective,
|
||
input: inputDirective,
|
||
textarea: inputDirective,
|
||
form: formDirective,
|
||
script: scriptDirective,
|
||
select: selectDirective,
|
||
style: styleDirective,
|
||
option: optionDirective,
|
||
ngBind: ngBindDirective,
|
||
ngBindHtml: ngBindHtmlDirective,
|
||
ngBindTemplate: ngBindTemplateDirective,
|
||
ngClass: ngClassDirective,
|
||
ngClassEven: ngClassEvenDirective,
|
||
ngClassOdd: ngClassOddDirective,
|
||
ngCloak: ngCloakDirective,
|
||
ngController: ngControllerDirective,
|
||
ngForm: ngFormDirective,
|
||
ngHide: ngHideDirective,
|
||
ngIf: ngIfDirective,
|
||
ngInclude: ngIncludeDirective,
|
||
ngInit: ngInitDirective,
|
||
ngNonBindable: ngNonBindableDirective,
|
||
ngPluralize: ngPluralizeDirective,
|
||
ngRepeat: ngRepeatDirective,
|
||
ngShow: ngShowDirective,
|
||
ngStyle: ngStyleDirective,
|
||
ngSwitch: ngSwitchDirective,
|
||
ngSwitchWhen: ngSwitchWhenDirective,
|
||
ngSwitchDefault: ngSwitchDefaultDirective,
|
||
ngOptions: ngOptionsDirective,
|
||
ngTransclude: ngTranscludeDirective,
|
||
ngModel: ngModelDirective,
|
||
ngList: ngListDirective,
|
||
ngChange: ngChangeDirective,
|
||
pattern: patternDirective,
|
||
ngPattern: patternDirective,
|
||
required: requiredDirective,
|
||
ngRequired: requiredDirective,
|
||
minlength: minlengthDirective,
|
||
ngMinlength: minlengthDirective,
|
||
maxlength: maxlengthDirective,
|
||
ngMaxlength: maxlengthDirective,
|
||
ngValue: ngValueDirective,
|
||
ngModelOptions: ngModelOptionsDirective
|
||
}).
|
||
directive({
|
||
ngInclude: ngIncludeFillContentDirective
|
||
}).
|
||
directive(ngAttributeAliasDirectives).
|
||
directive(ngEventDirectives);
|
||
$provide.provider({
|
||
$anchorScroll: $AnchorScrollProvider,
|
||
$animate: $AnimateProvider,
|
||
$browser: $BrowserProvider,
|
||
$cacheFactory: $CacheFactoryProvider,
|
||
$controller: $ControllerProvider,
|
||
$document: $DocumentProvider,
|
||
$exceptionHandler: $ExceptionHandlerProvider,
|
||
$filter: $FilterProvider,
|
||
$interpolate: $InterpolateProvider,
|
||
$interval: $IntervalProvider,
|
||
$http: $HttpProvider,
|
||
$httpBackend: $HttpBackendProvider,
|
||
$location: $LocationProvider,
|
||
$log: $LogProvider,
|
||
$parse: $ParseProvider,
|
||
$rootScope: $RootScopeProvider,
|
||
$q: $QProvider,
|
||
$$q: $$QProvider,
|
||
$sce: $SceProvider,
|
||
$sceDelegate: $SceDelegateProvider,
|
||
$sniffer: $SnifferProvider,
|
||
$templateCache: $TemplateCacheProvider,
|
||
$templateRequest: $TemplateRequestProvider,
|
||
$timeout: $TimeoutProvider,
|
||
$window: $WindowProvider,
|
||
$$rAF: $$RAFProvider,
|
||
$$asyncCallback : $$AsyncCallbackProvider
|
||
});
|
||
}
|
||
]);
|
||
}
|