RESTRICT
— This property controls the use of the custom directive.
— A Directive in AngularJS can be used as Attribute, Element, Class,Comment.It can have the value of any combination of A|E|C|M.
Example,
restrict : “AC” designates the custom directive can only be used as an attribute or class.
—The default value of restrict property is ‘A’ if nothing is supplied to it.
REPLACE
—This property takes Boolean(TRUE or FALSE) value as input.
—If It is true it replaces the current element with the given template.
—If it is false it appends the template to the current element.
Example,
replace: true designates the current element will be removed and the template will be placed in that position.
TEMPLATE
—This property takes the value as HTML markup STRING.
—This markup will be replaced/appended to the current element.
—It can also take a function as value and tElement and tAttr as parameters. and returns a STRING.
— Syntax ,
function(tElement, tAttr){
…
…
return STRING;
}
— tElement and tAttr refers to template member element and attributes.
Example,
template:”<h2>Hello</h2>” designates a template string that will replave/append the current Element.
TEMPLATEURL
— This property is alternative option for ‘TEMPLATE‘.
—This property accepts a URL value.
PRIORITY
—This property takes NUMBER as value.
—This property determines the ORDER OF EXECUTION of directives.Higher the value of priority it will run first.
—The default value of priority for a directive is 0.
TERMINAL
—This property takes Boolean(TRUE or FALSE) as value.
—When this property set to TRUE the directive will execute at LAST.
TRANSCUDE
—This property takes true or element as value.
—Based on the input value it compiles the current directive or elements and makes it available to present directive.
SCOPE
—This property is very vital on determining the current scope of the directive.
—It takes two type of values either TRUE or an Unanimous JavaScript object {} with some attribute and values.
—Use of this properties are:-
TRUE : It creates new scope and with access to the current parent scope(normal scope).
{} : Creates a new sope and separate it to the current scope without access to parent directive scope(isolate scope). This object has following attributes for configure @, &,=.
—We will learn more use of this property on my coming posts in future.
CONTROLLER
—This property is use like a initializer and can be used as passing values among directives.
—Happens In pre linking stage.
—Has the below property access $scope, $element, $attr, $transclude.
REQUIER
—This property is for injecting other required directive or set of directives.
—It takes a string or array of string of directive name as input.
CONTROLLERAS
—This property is for alias name of the controller.
—It is useful for nick name.