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.
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
- changes the button text to “Uninstall”
Finally, use the new directive in the view:
In index.html, add the new
<install-app> element inside the
.card div under the
View the AngularJS app in the browser by typing http://localhost:8000.