# Class $CompileProvider

- Defined in core/compile/compile.js:55
- Defined in core/compile/compile.js:54

#####
Index

### Constructors

constructor

### Properties

$get
aHrefSanitizationTrustedUrlList
addPropertySecurityContext
component
directive
imgSrcSanitizationTrustedUrlList
strictComponentBindingsEnabled
$inject

##
Constructors

### constructor

- new $CompileProvider($provide, $$sanitizeUriProvider): $CompileProvider

- #### Parameters

  - $provide: any
  - $$sanitizeUriProvider: any

  #### Returns $CompileProvider

  - Defined in core/compile/compile.js:55

##
Properties

### $get

$get: (string | (($injector: InjectorService, $interpolate: any, $exceptionHandler: any, $templateRequest: any, $parse: ParseService, $controller: any, $rootScope: Scope, $sce: any, $animate: any) => (($compileNodes: string | NodeList, transcludeFn: any, maxPriority: any, ignoreDirective: any, previousCompileContext: any) => ((scope: any, cloneConnectFn: any, options: any) => JQLite))))[]

- Defined in core/compile/compile.js:516

### aHrefSanitizationTrustedUrlList

aHrefSanitizationTrustedUrlList: ((regexp: RegExp) => RegExp | $CompileProvider)

Retrieves or overrides the default regular expression that is used for determining trusted safe urls during a[href] sanitization.

The sanitization is a security measure aimed at preventing XSS attacks via html links.

Any url about to be assigned to a[href] via data-binding is first normalized and turned into an absolute url. Afterwards, the url is matched against the `aHrefSanitizationTrustedUrlList` regular expression. If a match is found, the original url is written into the dom. Otherwise, the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.

#### Type declaration

- - (regexp): RegExp | $CompileProvider

  - #### Parameters

    - regexp: RegExp

      New regexp to trust urls with.

    #### Returns RegExp | $CompileProvider

    Current RegExp if called without value or self for chaining otherwise.

- Defined in core/compile/compile.js:368

### addPropertySecurityContext

addPropertySecurityContext: ((elementName: string, propertyName: string, ctx: string) => any)

Defines the security context for DOM properties bound by ng-prop-*.

#### Type declaration

- - (elementName, propertyName, ctx): any

  - #### Parameters

    - elementName: string

      The element name or '*' to match any element.

    - propertyName: string

      The DOM property name.

    - ctx: string

      The $sce security context in which this value is safe for use, e.g. `$sce.URL`

    #### Returns any

    `this` for chaining

- Defined in core/compile/compile.js:435

### component

component: ((name: any, options: any) => $CompileProvider)

#### Type declaration

- - (name, options): $CompileProvider

  - #### Parameters

    - name: any

      Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`), or an object map of components where the keys are the names and the values are the component definition objects.

    - options: any

      Component definition object (a simplified {directive definition object}), with the following properties (all optional):

      - `controller` – `{(string|function()=}` – controller constructor function that should be associated with newly created scope or the name of a {controller} if passed as a string. An empty `noop` function by default.

      - `controllerAs` – `{string=}` – identifier name for to reference the controller in the component's scope. If present, the controller will be published to scope under the `controllerAs` name. If not present, this will default to be `$ctrl`.

      - `template` – `{string=|function()=}` – html template as a string or a function that returns an html template as a string which should be used as the contents of this component. Empty string by default.

        If `template` is a function, then it is {injected} with the following locals:

        - `$element` - Current element
        - `$attrs` - Current attributes object for the element

      - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html template that should be used as the contents of this component.

        If `templateUrl` is a function, then it is {injected} with the following locals:

        - `$element` - Current element
        - `$attrs` - Current attributes object for the element

      - `bindings` – `{object=}` – defines bindings between DOM attributes and component properties. Component properties are always bound to the component controller and not to the scope. See {`bindToController`}.

      - `transclude` – `{boolean=}` – whether {content transclusion} is enabled. Disabled by default.

      - `require` - `{Object<string, string>=}` - requires the controllers of other directives and binds them to this component's controller. The object keys specify the property names under which the required controllers (object values) will be bound. See {`require`}.

      - `$...` – additional properties to attach to the directive factory function and the controller constructor function. (This is used by the component router to annotate)

    #### Returns $CompileProvider

    the compile provider itself, for chaining of function calls.

- Defined in core/compile/compile.js:287

### directive

directive: ((name: any, directiveFactory: Function | any[]) => $CompileProvider)

Register a new directive with the compiler.

#### Type declaration

- - (name, directiveFactory): $CompileProvider

  - #### Parameters

    - name: any

      Name of the directive in camel-case (i.e. `ngBind` which will match as `ng-bind`), or an object map of directives where the keys are the names and the values are the factories.

    - directiveFactory: Function | any[]

      An injectable directive factory function. See the guide/directive directive guide and the $compile compile API for more info.

    #### Returns $CompileProvider

    Self for chaining.

- Defined in core/compile/compile.js:191

### imgSrcSanitizationTrustedUrlList

imgSrcSanitizationTrustedUrlList: ((regexp: RegExp) => RegExp | $CompileProvider)

Retrieves or overrides the default regular expression that is used for determining trusted safe urls during img[src] sanitization.

The sanitization is a security measure aimed at prevent XSS attacks via html links.

Any url about to be assigned to img[src] via data-binding is first normalized and turned into an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationTrustedUrlList` regular expression. If a match is found, the original url is written into the dom. Otherwise, the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.

#### Type declaration

- - (regexp): RegExp | $CompileProvider

  - #### Parameters

    - regexp: RegExp

      New regexp to trust urls with.

    #### Returns RegExp | $CompileProvider

    Current RegExp if called without value or self for chaining otherwise.

- Defined in core/compile/compile.js:391

### strictComponentBindingsEnabled

strictComponentBindingsEnabled: ((enabled: any) => boolean | $CompileProvider)

- Defined in core/compile/compile.js:414

### `Static`$inject

$inject: string[]

- Defined in core/compile/compile.js:54