Chapter 5. AngularJS Views and Bootstrap
We will now start a new AngularJS blog project that uses public REST services created especially for this book. We will work on the blog project for the rest of this book. You can also download the project code from GitHub. We will start off by building the views and the controllers for those views.
Twitter Bootstrap is a free collection of HTML and CSS templates. We will build the AngularJS views with the help of Twitter Bootstrap to help cut development time. Once we have the views and controllers in place and understand their operation, we will focus on the model and REST services (in the next two chapters).
AngularJS Templates
AngularJS views are defined by building templates (partials). Views in AngularJS are composed of HTML code with directives added, such as the ng-model
directive shown previously. AngularJS builds the views dynamically at runtime by merging the templates with the properties passed to the templates in the $scope
object. The end result is pure HTML code bound to the ng-view
directive, as explained back in Chapter 1. We will cover the ng-view
directive again in this chapter as a review.
Creating the Blog Project
Start a new HTML5 project in NetBeans and call it AngularJsBlog. Set up the folder structure as shown in Figure 5-1. Move the downloaded AngularJS, jQuery, and Bootstrap library files to the js/libs folder, as shown.
We’ll begin with the code for the index.html ...
Get Learning AngularJS 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.