<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular-route.js"></script> <script> var module = angular.module("MyModule", ["ngRoute"]); module.config(function ($routeProvider) { $routeProvider .when("/login", { templateUrl: "login.html", controller: "loginController" }) .when("/user", { templateUrl: "user.html", controller: "userController" }) .when("/", { templateUrl: "main.html" }) }); module.controller("loginController", function ($scope) { $scope.message = "Login Test"; }); module.controller("userController", function ($scope) { $scope.message = "User Test"; }); </script> </head> <body ng-app="MyModule"> <a href="#!/login">Login</a> <a href="#!/user">User</a> <div ng-view></div> </body> </html> Login.html : {{ message }}
<a href="#login">Login</a> <a href="#user">User</a>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)