mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
When we refactored , we broke the csp mode because the previous implementation relied on the fact that it was ok to lazy initialize the .csp property, this is not the case any more. Besides, we need to know about csp mode during bootstrap and avoid injecting the stylesheet when csp is active, so I refactored the code to fix both issues. PR #4411 will follow up on this commit and add more improvements. Closes #917 Closes #2963 Closes #4394 Closes #4444 BREAKING CHANGE: triggering ngCsp directive via `ng:csp` attribute is not supported any more. Please use data-ng-csp instead.
134 lines
4.3 KiB
JavaScript
Executable file
134 lines
4.3 KiB
JavaScript
Executable file
'use strict';
|
||
|
||
/**
|
||
* @ngdoc property
|
||
* @name angular.version
|
||
* @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) {
|
||
$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,
|
||
required: requiredDirective,
|
||
ngRequired: requiredDirective,
|
||
ngValue: ngValueDirective
|
||
}).
|
||
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,
|
||
$sce: $SceProvider,
|
||
$sceDelegate: $SceDelegateProvider,
|
||
$sniffer: $SnifferProvider,
|
||
$templateCache: $TemplateCacheProvider,
|
||
$timeout: $TimeoutProvider,
|
||
$window: $WindowProvider
|
||
});
|
||
}
|
||
]);
|
||
}
|