Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<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 }}


What I have tried:

Can anyone tell me where is error please....This code is not working in my chrome.Please help me....
Posted
Updated 6-Jun-18 1:44am

1 solution

You need to just use,

<a href="#login">Login</a>
<a href="#user">User</a>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900