16.07.2017 Views

AngularJS Essentials

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 2<br />

scope: {<br />

topic: '=topic',<br />

description: '=description',<br />

close: '&close'<br />

},<br />

templateUrl: "alert.html",<br />

replace: true<br />

};<br />

});<br />

alert.html<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Close<br />

<br />

Note that if the name of the directive's scope property is the same as of the<br />

expression, we can keep just the prefix. By convention, the framework will consider<br />

the name to be the identical to the scope property name. Our last directive can be<br />

written as follows:<br />

directives.js<br />

parking.directive("alert", function () {<br />

return {<br />

restrict: 'E',<br />

scope: {<br />

topic: '=',<br />

description: '=',<br />

close: '&'<br />

},<br />

templateUrl: "alert.html",<br />

replace: true<br />

};<br />

});<br />

[ 41 ]<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!