Learn
Directives
installApp III

The template uses Angular’s built-in ng-click directive. When the button is clicked, ng-click will tell AngularJS to run the download() function in the directive.

The download() function uses the scope.installed property to check if an app is installed. When an app is installed, download() does three things:

  • toggles the .btn-active class
  • changes the button text to “Uninstall”
  • changes scope.installed to true

Instructions

1.

Finally, use the new directive in the view:

In index.html, add the new <install-app> element inside the .card div under the <app-info> element.

2.

View the AngularJS app in the browser by typing http://localhost:8000.

Folder Icon

Take this course for free

Already have an account?