Defining the Weather AngularJS View

With the controller in place, you can define the view to consume the weather data. Listing 29.11 shows the basic template that consumes the weather data from the scope and renders it as shown in Figure 29.2.

Image

Figure 29.2 The weather view allows you to quickly see the weather in a list of cities and add additional cities.

A text input at the top accepts the new city name and binds it to locationIn and a button that calls addCity() in the controller when clicked. Notice that all the weather data comes from the $scope.weather variable and is rendered using AngularJS expressions.

Listing 29.11 weather.html: Implementing ...

Get Node.js, MongoDB, and AngularJS Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.