//login.html
<div ng-controller="loginController">
<form action="/" id="myLogin">
User Name:<input type="text" ng-model="uname" /> <br />
Password: <input type="password" ng-model="passwd"/> <br />
<button type="button" ng-click="submit()">login</button>
</form>
</div>
//controller.js
var app = angular.module('myApp', ['ngRoute']);
app.config(function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'login.html'
})
.when('/employeeReg', {
templateUrl: 'employeeReg.html'
})
.otherwise({
redirectTo:'/'
})
});
app.controller('loginController', function($scope, $location) {
$scope.submit = function() {
if ($scope.uname == 'admin' && $scope.passwd == 'admin') {
$location.path('employeeReg.html');
} else {
alert('login failed');
}
};
});
Attached ImageCode funktioniert nicht in Winkel js
i sehr neu für Winkel js Dieses Beispielcode ist für Seite melde Dich an, aber wenn ich Index-Seite öffnen nichts zu sehen ist, sollte es umleiten page.any anmelden Hilfe würde geschätzt werden.
Arbeits Wo ist Ihre Index-Seite Code? – NNR
danke für die Antwort, eigentlich habe ich Screenshot von Code hinzugefügt, aber es ist nicht hier zu zeigen .. http://i.stack.imgur.com/GBdze.png in diesem Link Index-Code ist verfügbar .. – krish
Wo ist die Routing für die Indexseite in Ihrem Controller – NNR