MCPcopy Index your code
hub / github.com/angular-ui/ui-router / trustAs

Function trustAs

test/angular/1.4/angular.js:17169–17187  ·  view source on GitHub ↗

* @ngdoc method * @name $sceDelegate#trustAs * * @description * Returns an object that is trusted by angular for use in specified strict * contextual escaping contexts (such as ng-bind-html, ng-include, any src * attribute interpolation, any dom event binding attribute

(type, trustedValue)

Source from the content-addressed store, hash-verified

17167 * where Angular expects a $sce.trustAs() return value.
17168 */
17169 function trustAs(type, trustedValue) {
17170 var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
17171 if (!Constructor) {
17172 throw $sceMinErr('icontext',
17173 'Attempted to trust a value in invalid context. Context: {0}; Value: {1}',
17174 type, trustedValue);
17175 }
17176 if (trustedValue === null || isUndefined(trustedValue) || trustedValue === '') {
17177 return trustedValue;
17178 }
17179 // All the current contexts in SCE_CONTEXTS happen to be strings. In order to avoid trusting
17180 // mutable objects, we ensure here that the value passed in is actually a string.
17181 if (typeof trustedValue !== 'string') {
17182 throw $sceMinErr('itype',
17183 'Attempted to trust a non-string value in a content requiring a string: Context: {0}',
17184 type);
17185 }
17186 return new Constructor(trustedValue);
17187 }
17188
17189 /**
17190 * @ngdoc method

Callers 1

$SceProviderFunction · 0.70

Calls 1

isUndefinedFunction · 0.70

Tested by

no test coverage detected