I am new to Single Page Application. Explain Single Page Application. How does it work? Please explain me with an example with most simple way as you can.
HTMl code below:
<!doctype html>
<div ng-view></div>
<script src="app.js"></script>
Angular Javascript code below:
var app = angular.module('myApp', ['ngRoute']);
app.config(function($routeProvider) {
$routeProvider
.when('/', {
templateUrl : 'pages/home.html',
controller : 'HomeController'
})
.when('/blog', {
templateUrl : 'pages/blog.html',
controller : 'BlogController'
})
.otherwise({redirectTo: '/'});
});
Aucun commentaire:
Enregistrer un commentaire