Creating a basic Angular view with data binding
Angular.js allows us to create views with automated data binding. This means that we can specify model objects whose properties will bind to element properties or content.
Automated data binding simplifies programming. Instead of adding event listeners to watch for changes inside our elements and then manually updating elements by adding classes, changing attributes, or modifying their content, we can simply change the model objects, and the elements will get updated automatically.
In this recipe, we're going to create a simple currency converter that converts USD to GBP using a fixed conversion rate.
Getting ready
Angular is available via CDN, so no downloading is necessary. We can simply include it to our page.
How to do it...
Let's write the Angular template.
Create a file named index.html
that contains the following code:
<!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5...