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



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.


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

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?