object configure different routes in config method of the application body ng

Object configure different routes in config method of

This preview shows page 26 - 29 out of 29 pages.

object configure different routes in config method of the application
Image of page 26
< body ng-app ="myApp"> < a href ="#/"> Main < /a >|< a href ="#apple"> Apple < /a >|< a href ="#pear"> Pear < /a >| < a href ="#others"> Others < /a > <br> < div ng-view >< /div > < script > var app = angular.module( "myApp" , [ "ngRoute" ]); app.config( function ($routeProvider) { $routeProvider .when( "/" , { template : "<p>This is the main page.</p>" }) .when( "/apple" , { template : "<p>I love apple.</p>" }) .when( "/pear" , { template : "<p>Yellow pear.</p>" }) . otherwise ({ template : "<p>Nothing has been selected.</p>" }); }); < /script > </ body > Routing the otherwise method specifies the default route when none of the others is matched Instead of referring to an HTML page using templateUrl , use the template property to write HTML content directly in the container
Image of page 27
MEAN We will use the MEAN stack to implement a web service in Lab 7, using AngularJS as the web front-end AngularJS is the front-end part of the MEAN stack, which consists of M ongoDB database, E xpress.js web application server framework, A ngular.js , and N ode.js runtime environment. a free and open-source JavaScript software stack for building dynamic web sites and web applications
Image of page 28
References ,
Image of page 29

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture