Organizational Research By

Surprising Reserch Topic

how to pass data one page to another page using angular js


how to pass data one page to another page using angular js  using -'javascript,angularjs,asp.net-web-api,angularjs-ng-repeat'

Here I am Trying to Login with user credientials
if user is valid , I want to pass UserName,LastloginTime,Role values to another page using angular js

<form role="form" ng-app="MyApp" ng-controller="MasterController">
        <div class="form-group">
            <label>
                Username</label>

            <input type="text" class="form-control" placeholder="Username" required ng-model="username" />
        </div>
        <div class="form-group">
            <label>
                Password</label>
            <input type="password" class="form-control" placeholder="Password" required ng-model="password" />
        </div>
        <div class="checkbox">
            <label>
                <input type="checkbox" ng-model="remember">
                Remember my Password
            </label>
        </div>
        <input type="button" value="Submit" ng-click="GetData()" class="btn btn-danger" />
        <%--<button type="button" class="btn btn-danger" ng-click="GetData()">Submit</button>--%>
        <span ng-bind="Message"></span>
    </form>


js file here

   $scope.GetData = function () {
        debugger;
        var data = { UserName: $scope.username, Password: $scope.password };
        $http.post("api/Test/CheckUsername", data)
       .success(function (data, status, headers, config) {
           if (data != "") {
               $scope.Employees = data;
               window.location.href = "EmployeeMaster";
               //$scope.Reporting = data;
           }
           else {
               alert("Invalid Credientials");
           }

       });
    }


I want to display values in a master page

                        <table class="table">
                            <tr ng-repeat="Emp in Employees">
                                <th>User </th>
                                <td>:</td>
                                <td>{{Emp.username}}</td>
                            </tr>
                            <tr>
                                <th>Designation </th>
                                <td>:</td>
                                <td>{{Emp.RoleName}}</td>
                            </tr>
                            <tr>
                                <th>Last Login </th>
                                <td>:</td>
                                <td>{{Emp.LastLogin}}</td>
                            </tr>
                        </table>


How can i pass the values login page to Home page?
    

asked Oct 6, 2015 by nikhilapatil
0 votes
10 views



Related Hot Questions

5 Answers

0 votes
NULL
answered Oct 6, 2015 by dahiyabecomp
0 votes
NULL
answered Oct 6, 2015 by param.oncemore
0 votes
NULL
answered Oct 6, 2015 by sumit_jaiswalmca
0 votes
NULL
answered Oct 6, 2015 by badhwar.rohit
0 votes
NULL
answered Oct 6, 2015 by sumit_jaiswalmca

...