我现在使用 Angular js,当单击按钮时,我遇到错误,它将触发一个函数 这个函数传递一个值,它将像这样转换该值:1e+21但实际值是这样的:**01E000002M **
这是我的代码:
@using RamaReports.Entity;
@{
ViewBag.Title = "Student Details";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="right_col" role="main" ng-app="MyApp" ng-controller="LmsStudentCtrl">
<div class="">
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Student</h2>
<div class="clearfix"> (kindly select atleast one parameter value)</div>
</div>
<div class="x_content">
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="form-group">
<div class="control-label col-md-4 col-sm-12 col-xs-12">
Student Name:
</div>
<div class="col-md-8 col-sm-12 col-xs-12">
<input type="text" id="txtnamefilter" ng-model="EmpName" class="form-control" />
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="form-group">
<div class="control-label col-md-4 col-sm-12 col-xs-12">
Location:
</div>
<div class="col-md-8 col-sm-12 col-xs-12">
<select id="ddllocation" ng-model="ddlLocation" class="form-control" ng-change="LocationChange()">
<option ng-repeat="c in Location" value="{{c.Value}}">{{c.Text}}</option>
</select>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="=form-group">
<div class="control-label col-md-4 col-sm-12 col-xs-12">
Institute:
</div>
<div class="col-md-8 col-sm-12 col-xs-12">
<select id="ddlcompany" ng-model="ddlCompany" class="form-control" ng-change="CompanyChange()">
<option ng-repeat="c in Company" value="{{c.Value}}">{{c.Text}}</option>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="form-group">
<div class="control-label col-md-4 col-sm-12 col-xs-12">
Department
</div>
<div class="col-md-8 col-sm-12 col-xs-12">
<select id="ddldepartment" ng-model="ddlDepartment" class="form-control" ng-change="DepartmentChange()">
<option ng-repeat="c in Department" value="{{c.Value}}">{{c.Text}}</option>
</select>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="form-group">
<div class="control-label col-md-4 col-sm-12 col-xs-12">
Program:
</div>
<div class="col-md-8 col-sm-12 col-xs-12">
<select id="ddldesignation" ng-model="ddlDesignation" class="form-control">
<option ng-repeat="c in Designation" value="{{c.Value}}">{{c.Text}}</option>
</select>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="form-group">
<div class="control-label col-md-4 col-sm-12 col-xs-12">
Session:
</div>
<div class="col-md-8 col-sm-12 col-xs-12">
<select id="ddlemployementtype" ng-model="ddlEmployementType" class="form-control">
<option ng-repeat="c in EmployementType" value="{{c.Value}}">{{c.Text}}</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-12">
</div>
<div class="col-lg-4 col-md-4 col-sm-12">
<input type="button" id="btnfilter" ng-click="EmployeeList()" value="Search" class="btn btn-primary" />
</div>
</div>
</div>
<table id="datatable-responsive" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
<thead>
<tr>
<th>Action</th>
<th>Name</th>
<th>EmployeeCode</th>
<th>Location</th>
<th>Company</th>
<th>Department</th>
<th>Designation</th>
</tr>
</thead>
<tbody></tbody>
</table>
<input type="button" id="btnopenmmodal" data-target="#dvModalForm" style="display:none;" data-toggle="modal" />
<div id="dvModalForm" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Details</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="form-group">
<div class="col-lg-3 col-md-4 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">Personal Detail</div>
<div class="panel-body">
<div class="profile clearfix">
@*<img src="data:image/jpg;base64,{{empimage}}" alt="..." class="img-circle profile_img" style="height:56px;width: 56px;">*@
<table id="datatable-personal" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0">
<thead>
<tr>
<th colspan="2">{{empname.EmpName}}</th>
</tr>
</thead>
<tbody>
<tr><td>Location : </td><td><span>{{empname.Location_name}}</span></td></tr>
<tr><td>Company :</td><td>{{empname.company_name}} </td></tr>
<tr><td>Department :</td><td>{{empname.Department_Name}} </td></tr>
<tr><td>Designation :</td><td>{{empname.Designation_Name}} </td></tr>
<tr><td>Biometric Id :</td><td>{{empname.biometrics_id}} </td></tr>
<tr><td>DOB :</td><td>{{empname.date_of_birth}} </td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-5 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">Contact</div>
<div class="panel-body">
<table id="datatable-contact" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0">
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr><td>Father :</td><td>{{empname.father_name}} </td></tr>
<tr><td>Phone :</td><td>{{empname.phone_no}} </td></tr>
<tr><td>Mobile :</td><td>{{empname.mobile_no}} </td></tr>
<tr><td>Pan :</td><td>{{empname.pan_no}} </td></tr>
<tr><td>Adhar :</td><td>{{empname.emp_adhaar_no}} </td></tr>
<tr><td>Email :</td><td>{{empname.email_id}} </td></tr>
<tr><td>Off. Email :</td><td>{{empname.official_email}} </td></tr>
<tr><td>Address :</td><td>{{empname.Address}} </td></tr>
<tr><td>City :</td><td>{{empname.city}} </td></tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-lg-5 col-md-3 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">Salary</div>
<div class="panel-body">
<table id="datatable-salary" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
<thead>
<tr>
<th>Effctive Date</th>
<th>Salary Type</th>
<th>Salary</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">KPA</div>
<div class="panel-body">
<table id="datatable-kpa" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
<thead>
<tr>
<th>KPA</th>
<th>KPA Goal</th>
<th>Wightage</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var hostUrl = $("#hdnAppRoot").val();
var AngularApp = angular.module("MyApp", []);
//AngularApp.controller("HrmsEmpCtrl", function ($scope, $http) {
AngularApp.controller('LmsStudentCtrl', ['$scope', '$compile', function ($scope, $compile, $http) {
$scope.empname = [];
$scope.Location = [];
$scope.Company = [{ Text: " --Select--", Value: "0" }]
$scope.ddlCompany = $scope.Company[0].Value.toString();
$scope.Department = [{ Text: " --Select--", Value: "0" }]
$scope.ddlDepartment = $scope.Department[0].Value.toString();
$scope.Designation = [{ Text: " --Select--", Value: "0" }]
$scope.ddlDesignation = $scope.Designation[0].Value.toString();
$scope.EmployeeList = function () {
var t = { EmpName: $scope.EmpName, LocationId: $scope.ddlLocation, CompanyId: $scope.ddlCompany, DepartmentId: $scope.ddlDepartment, DesignationId: $scope.ddlDesignation, EmployementTypeId: $scope.ddlEmployementType, emp_id: 0 }
$.ajax({
type: "POST",
url: '' + hostUrl + '/Home/StudentDetailsList',
data: t,
success: function (empdate) {
var dataforTable = empdate;
$('#datatable-responsive').DataTable({
//paging: true,
//searching: true,
destroy: true,
data: dataforTable,
//scroll:true,
columns: [
{
title: "Action", render: function (datum, type, row) {
return "<button type='button' class='btn btn-danger btn-xs' ng-click='EmpDetails(" + row.emp_id + ")'><i class='fa fa-trash-o'></i>Details</button>";
}
},
{ title: "Location", data: "Location_name" },
{ title: "RUM No", data: "EmpSalary" },
{ title: "Student Name", data: "company_name" },
{ title: "Father Name", data: "father_name" },
{ title: "Year", data: "Department_Name" },
{ title: "Semster", data: "pan_no" },
],
createdRow: function (row, data, dataIndex) {
$compile(angular.element(row).contents())($scope);
}
});
},
error: function (xhr, ajaxOptions, thrownError) {
}
});
}
$scope.LocationDropdown = function () {
$.ajax({
type: "POST",
url: '' + hostUrl + '/Home/HrmsDropdown',
data: { Flag: "LoctionLMS", Id: 0 },
success: function (mRes) {
console.log(mRes);
$scope.$apply(function () { $scope.Location = mRes; $scope.ddlLocation = $scope.Location[0].Value.toString(); })
},
error: function (xhr, ajaxOptions, thrownError) {
}
});
}
$scope.LocationDropdown();
$scope.LocationChange = function () {
debugger;
$.ajax({
type: "POST",
url: '' + hostUrl + '/Home/HrmsDropdownLMS',
data: { Flag: "LMSDivision", Id: $scope.ddlLocation },
success: function (mRes) {
$scope.$apply(function () {
$scope.Company = mRes;
$scope.ddlCompany = $scope.Company[0].Value.toString();
})
},
error: function (xhr, ajaxOptions, thrownError) {
}
});
}
$scope.CompanyChange = function () {
$.ajax({
type: "POST",
url: '' + hostUrl + '/Home/HrmsDropdownLMS',
data: { Flag: "LMSDepartment", Id: $scope.ddlCompany },
success: function (mRes) {
$scope.$apply(function () {
$scope.Department = mRes;
$scope.ddlDepartment = $scope.Department[0].Value.toString();
})
},
error: function (xhr, ajaxOptions, thrownError) {
}
});
$.ajax({
type: "POST",
url: '' + hostUrl + '/Home/HrmsDropdownLMS',
data: { Flag: "Session", Id: $scope.ddlCompany },
success: function (mRes) {
$scope.$apply(function () { $scope.EmployementType = mRes; $scope.ddlEmployementType = $scope.EmployementType[0].Value.toString(); })
},
error: function (xhr, ajaxOptions, thrownError) {
}
});
}
$scope.DepartmentChange = function () {
$.ajax({
type: "POST",
url: '' + hostUrl + '/Home/HrmsDropdownLMS',
data: { Flag: "LMSProgram", Id: $scope.ddlDepartment },
success: function (mRes) {
$scope.$apply(function () {
$scope.Designation = mRes;
$scope.ddlDesignation = $scope.Designation[0].Value.toString();
})
},
error: function (xhr, ajaxOptions, thrownError) {
}
});
}
debugger;
//01E000002M
$scope.EmpDetails = function (emp_id) {
$.ajax({
type: "POST",
url: '' + hostUrl + '/Home/HrmsEmployeeImage',
data: { LocationId: "0", CompanyId: "0", DepartmentId: "0", DesignationId: "0", EmployementTypeId: "0", emp_id: emp_id },
success: function (empdate) {
$scope.$apply(function () { $scope.empname = empdate[0] });
$("#btnopenmmodal").click();
},
error: function (xhr, ajaxOptions, thrownError) {
}
});
debugger;
$.ajax({
type: "POST",
url: '' + hostUrl + '/Home/HrmsEmployeeImage',
data: { emp_id: emp_id },
success: function (empsalary) {
var dataforTable = empsalary;
$('#datatable-salary').DataTable({
paging: false,
searching: false,
destroy: true,
data: dataforTable,
columns: [
// { title: "salaryType", data: "salaryType" },
// { title: "seffectiveDate", data: "seffectiveDate" },
// { title: "EffectiveDateSlry", data: "EffectiveDateSlry" }
],
createdRow: function (row, data, dataIndex) {
$compile(angular.element(row).contents())($scope);
}
});
},
error: function (xhr, ajaxOptions, thrownError) {
}
});
$.ajax({
type: "POST",
url: '' + hostUrl + '/Home/HrmsEmployeeImage',
data: { emp_id: emp_id },
success: function (empdate) {
$scope.$apply(function () { $scope.empimage = empdate[0].image });
},
error: function (xhr, ajaxOptions, thrownError) {
}
});
debugger;
$.ajax({
type: "POST",
url: '' + hostUrl + '/Home/StudentList',
data: { emp_id: emp_id },
success: function (empsalary) {
var dataforTable = empsalary;
$('#datatable-kpa').DataTable({
paging: false,
searching: false,
destroy: true,
data: dataforTable,
columns: [
{ title: "KPA", data: "KPA" },
{ title: "KPA Goal", data: "KPA_Goal" },
{ title: "Weightage", data: "KPA_Weightage" }
],
createdRow: function (row, data, dataIndex) {
$compile(angular.element(row).contents())($scope);
}
});
},
error: function (xhr, ajaxOptions, thrownError) {
}
});
}
}]);
</script>
我尝试转换字符串但没有解决方案。
columns: [
{
title: "Action", render: function (datum, type, row) {
return "<button type='button' class='btn btn-danger btn-xs' ng-click=\"EmpDetails('" + row.emp_id + "')\"><i class='fa fa-trash-o'></i>Details</button>";
}
},
我用这个它正在工作