Credit to devdocs.io

angularjs 1.4

angularjs

Improve this Doc View Source $compileProvider

  1. $compile
  2. provider in module ng

Methods

  • directive(name, directiveFactory);

    Register a new directive with the compiler.

    Parameters

    Param Type Details
    name stringObject

    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()Array

    An injectable directive factory function. See directive for more info.

    Returns

    ng.$compileProvider

    Self for chaining.

  • aHrefSanitizationWhitelist([regexp]);

    Retrieves or overrides the default regular expression that is used for whitelisting of 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 aHrefSanitizationWhitelist 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.

    Parameters

    Param Type Details
    regexp
    (optional)
    RegExp

    New regexp to whitelist urls with.

    Returns

    RegExpng.$compileProvider

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

  • imgSrcSanitizationWhitelist([regexp]);

    Retrieves or overrides the default regular expression that is used for whitelisting of 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 imgSrcSanitizationWhitelist 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.

    Parameters

    Param Type Details
    regexp
    (optional)
    RegExp

    New regexp to whitelist urls with.

    Returns

    RegExpng.$compileProvider

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

  • debugInfoEnabled([enabled]);

    Call this method to enable/disable various debug runtime information in the compiler such as adding binding information and a reference to the current scope on to DOM elements. If enabled, the compiler will add the following to DOM elements that have been bound to the scope

    • ng-binding CSS class
    • $binding data property containing an array of the binding expressions

    You may want to disable this in production for a significant performance boost. See Disabling Debug Data for more.

    The default value is true.

    Parameters

    Param Type Details
    enabled
    (optional)
    boolean

    update the debugInfoEnabled state if provided, otherwise just return the current debugInfoEnabled state

    Returns

    *

    current value if used as getter or itself (chaining) if used as setter

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://code.angularjs.org/1.4.14/docs/api/ng/provider/$compileProvider