Book Image

AngularJS Web Application Development Blueprints

By : Vinci J Rufus
Book Image

AngularJS Web Application Development Blueprints

By: Vinci J Rufus

Overview of this book

Table of Contents (17 chapters)
AngularJS Web Application Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Building the admin section for CRUD operations


We will now look to build the admin section of our CMS using Angular JS. The AngularJS app will talk to the backend ExpressJS scripts that we just wrote in the preceding section.

Creating the routes for the admin section

Ideally, we would like our admin section to be called from within the admin URL, so let's go ahead and add the routes for the admin section of the AngularJS app.

Add the following routes to the angcms/public/js/app.js file:

config(['$routeProvider', '$locationProvider',
    function($routeProvider, $locationProvider) {

        $routeProvider.when('/admin/login', {
            templateUrl: 'partials/admin/login.html',
            controller: 'AdminLoginCtrl'
        });
        $routeProvider.when('/admin/pages', {
            templateUrl: 'partials/admin/pages.html',
            controller: 'AdminPagesCtrl'
        });
        $routeProvider.when('/admin/add-edit-page/:id', {
            templateUrl: 'partials/admin/add-edit-page...