Base solution for your next web application
Open Closed

data is not shown on html page. #345


User avatar
0
abu created

this is my .js file

(function () {
    var controllerId = 'logincontroller';
    angular.module('app').controller(controllerId, [
        '$scope', '$location', 'abp.services.practise.employee', function ($scope, $location, employeeService) {
            var vm = this;
            var localize = abp.localization.getSource('Practise');
            vm.logininfo = {};

            vm.employee = [];

          

            vm.logincheck = function () {

                employeeService.getEmployee(vm.logininfo).success(function (data) {
                    debugger;
                    alert("success");
                    vm.employee = data.employee
                    // $location.path('/dashboard');
                })
            };
        }]);
})();

this is my class file coding.

public GetEmployeesOutput GetEmployee(GetEmployeesInput input)
        {
            
                var userinfo = _userRepository.GetAll().Where(m => m.EmailID == input.Email && m.Password == input.Password).FirstOrDefault();

                var employee = _employeeRepository.GetAll().Where(p => p.UserId == userinfo.Id).FirstOrDefault();
                var employeedetail = _employeeRepository.Get(employee.Id);
               
                return new GetEmployeesOutput
                {
                    Employee = Mapper.Map<EmployeeDto>(employeedetail)
                };
                         
        }

this is my html page coding

<div ng-controller="logincontroller as vm">
        <div class="logobox">
            <table style="border-width:thick">
                <tr>
                    <th>firstname</th>
                    <th>lastname</th>
                </tr>
                <tr ng-repeat="emp in vm.employee">
                    <td><input id="Text1" type="text" ng-model="emp.firstName" /></td>
                    <td><input id="Text2" type="text" ng-model="emp.lastName" /></td>
                </tr>
            </table>
        </div>
</div>

no errors data is fetching on employee object visible in firefox debugger.

please reply sir.


1 Answer(s)
  • User Avatar
    0
    abu created

    Above problem resolved. i want to know one thing i have a. loginpage with login.js in login folder in views folder.

    through login.js i fetched the data by using following code

    (function () {
        var controllerId = 'logincontroller';
        angular.module('app').controller(controllerId, [
            '$scope', '$location', 'abp.services.practise.employee', function ($scope, $location, employeeService) {
                var vm = this;
                var localize = abp.localization.getSource('Practise');
                vm.logininfo = {};
    
                vm.employees = [];
    
              
    
                vm.logincheck = function () {
    
                    employeeService.getEmployee(
                        vm.logininfo
                    ).success(function (data) {
                       // debugger;
                        alert("success");
                        vm.employees = data.employees
                        $location.path('/dashboard');
                    })
                };
    
    
            }]);
    })();
    

    now by using $location.path to dashboard page now i want the collected information shown in dashboard cshtml page how i will do this...????

    please help