Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var myapp = angular
- .module("mainModule", ['ngRoute'])
- .config(function ($routeProvider, $locationProvider) {
- $routeProvider
- .when("/login", {
- templateUrl: "Templates/login.html",
- controller: "LoginController",
- controllerAs: "loginctrl",
- caseInsensitiveMatch: true
- })
- .when("/Home", {
- templateUrl: "Templates/Home.html",
- controller: "HomeController",
- controllerAs: "Homectrl",
- caseInsensitiveMatch: true
- })
- })
- .controller("LoginController", function ($scope, $location) {
- $scope.username = "";
- $scope.password = "";
- $scope.Login = function () {
- if ($scope.username == "a" || $scope.password == "a") {
- alert("SuccessFully Logged in")
- $location.path("/Home");
- }
- //alert('Hello'+$scope.username+""+$scope.password);
- }
- })
- .controller("HomeController", function ($scope) {
- })
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml" ng-app="mainModule">
- <head>
- <title></title>
- <script src="../Scripts/angular.js"></script>
- <script src="../Scripts/angular-route.js"></script>
- <script src="../index.js"></script>
- </head>
- <body>
- <div ng-controller="LoginController">
- <table>
- <tbody>
- <tr>
- <th>UserName:</th>
- <th><input type="text" value="" ng-model="username" /></th>
- </tr>
- <tr>
- <th>Password:</th>
- <th><input type="password" value="" ng-model="password" /></th>
- </tr>
- <tr>
- <th><button name="Submit" ng-click="Login()"> Submit</button>
- </tr>
- </tbody>
- </table>
- </div>
- </body>
- </html>
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml ng-app=" mainmodule">
- <head>
- <title></title>
- <script src="../Scripts/angular.js"></script>
- <script src="../Scripts/angular-route.js"></script>
- <script src="../index.js"></script>
- </head>
- <body ng-controller="HomeController">
- hi
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement