Skip to Content
installApp II

We used app.directive to create a new directive named 'installApp'.

  • The directive contains the three options restrict, scope, and templateUrl that we saw before in the 'appInfo' directive.
  • It also contains a fourth option link. The link is used to create interactive directives that respond to user actions.

The link function takes three inputs:

  1. scope refers to the directive’s scope. Any new properties attached to $scope will become available to use in the directive’s template.
  2. element refers to the directive’s HTML element.
  3. attrs contains the element’s attributes.

Inside the link function, there are two properties buttonText and installed, and the function download(). We’ll use these in the directive’s template next.



Next, write the directive’s template:

In the new file js/directives/installApp.html. Type in the following HTML:

<button class="btn btn-active" ng-click="download()"> {{ buttonText }} </button>
Folder Icon

Take this course for free

Already have an account?