Chris J. Lee

Dallas Drupal Developer

You are here

AngularJS - Valid values for restrict

As per Angular 1.4, there are several valid values for the restrict key in angular.

Where restrict is defined is usually in a return of a directive. Like the following:

Example of restrict

app.directive('foo', function() {
    return {
    // Restrict Key 
    'restrict': 'E', 
    // ...
   }
});

Here are the following possible values for the restrict:

  ‘A’ – Attribute (You want to use your directive as 
) ‘E’ – Element (Use it as ) ‘C’ – Class. (Use it like
) ‘M’ – Comment (Use it like

Source

Restrict Values

app.directive('foo', function() {
    return {
    // Restrict Key 
    'restrict': 'E', 
    // ...
   }
});
Tags: 
angularjs
© 2017 Chris J. Lee