如何重定向到angularjs中的另一个ui-sref页面并显示第二页和第一页隐藏?

时间:2018-05-30 20:25:06

标签: html angularjs asp.net-mvc angular-ui-router

  

当我通过使用(ui-view)重定向我面对这样你可以看到图像...   但我想重定向到第二页,登录页面应隐藏使用ui-view?

  

html代码:在这里你可以看到

<div class="log-w3" ng-app="log" ng-controller="logcontroller">
    <div class="w3layouts-main">
        <h2>Sign In Now</h2>
        <input type="text" ng-model="log.UserName" class="ggg" name="UserName" placeholder="E-MAIL" required="">
        <input type="password" id="txtpassword" class="ggg" ng-model="log.Password" name="Password" placeholder="PASSWORD" required="">
        <span><input type="checkbox" />Remember Me</span>
        <h6><a href="#">Forgot Password?</a></h6>
        <div class="clearfix"></div>
        <input type="submit" ng-click="login(log)" value="Sign In" name="login">
        <img src="~/Design/images/loader.gif" id="loader" width="80" height="80" />
        <div class="alert alert-success alert-dismissible" id="msg">
            <a href="#" class="close" data-dismiss="alert" aria-label="close"></a>
            <strong>Success!</strong> Congraculation You Have Successfully Login!
        </div>
        <div class="alert alert-danger alert-dismissible" id="error">
            <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
            <strong>Danger!</strong> Invalid Username or Password!
        </div>
        <p>Don't Have an Account ?<a href="registration.html">Create an account</a></p>
    </div>
     <ui-view></ui-view>
</div>
  

angular js code:你可以看到我使用$ state.go

的角度js代码
.controller('logcontroller', function ($scope, Notification, $state, $http, cfpLoadingBar) {

                $scope.login = function (log) {
                    $http.post("/Login/Info", log).then(function (response) {
                        cfpLoadingBar.start();
                        //console.log(JSON.stringify(response))
                        if (response.data.success) {
                            console.log('Login sucessfull');
                            Notification.success(response.data.message)
                            $state.go("/Log");
                        } else {
                            //alert(response.data.message)
                            Notification.error(response.data.message)
                        }
                        cfpLoadingBar.complete();
                    }, function () {
                        alert("Wrong ha")
                    })
                }
            })
            .config(function ($stateProvider) {
                $stateProvider
                    .state("/Log",
                    {
                        url: "Welcome",
                        templateUrl: "/Dash/Index"
                    })
            });

0 个答案:

没有答案