From the course: The DOM in JavaScript, jQuery, AngularJS, and React

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

From the DOM to directives

From the DOM to directives

From the course: The DOM in JavaScript, jQuery, AngularJS, and React

Start my 1-month free trial

From the DOM to directives

- [Instructor] One of the most powerful features of AngularJS is directives, Directives are things like ng-app, the ng-controller, repeat, model, and so on. Now this controllers for example is a directive that you can use as an attribute like most of these are. But you can also use it as an element. And that is one of the feature that you can do when you create your own custom directives. So for example, I can add this controller and you control as an element. And let me just do that now to show you I'm going to add some lines down the bottom so we have some rooms to type. So right in here, I'm going to add new controller. And I use the ng-controller as a directive or treat it as an element. Okay, so it looks like just the regular html element. And I'm going to include here the attribute ng-controller itself. And I'm going to create a new controller called NgController. You can call it whatever you want. Then inside this controller, I'm going to add a message, going to say, "Hi." And…

Contents