For populating a dropdownlist
using angularjs
, I attempted the following:
var app = angular.module('App', []);
app.controller('UserSelection', function ($scope, $location) {
var User = this;
User.onSelectChange = function () {
if (User.UserSelected == 'SAP_Executive') {
window.location.href = '/App/Assign';
} else if (User.UserSelected == 'Fiber_Engineer') {
window.location.href = '/App/Certify';
} else if (User.UserSelected == 'Fiber_Lead' || User.UserSelected == 'CMM') {
window.location.href = '/App/Approval';
} else {
window.location.href = '/';
}
};
});
/******************************** R4G State bind ****************************************************/
var assign = angular.module('Assign', []);
assign.factory('SAPExecutive_Service', ['$http', function ($http) {
var SAPExecutive_Service = {};
SAPExecutive_Service.getBillCutDate = function () {
return $http({
method: "POST",
url: AppConfig.PrefixURL + "App/GetBillCutDate",
dataType: 'json',
headers: { "Content-Type": "application/json" }
});
};
<!-- More code here -->
return SAPExecutive_Service;
}]);
<!-- More code here -->
assign.controller('confirmPopupController', function ($scope, $http, SAPExecutive_Service) {
$scope.submitForm = function () {
<!-- Code block for submitForm function goes here -->
}
});
assign.controller('FiberEngineer_Filter', function ($scope, $http, SAPExecutive_Service) {
var Filter = this;
var StateList = {};
var ZoneValue = "";
$scope.UserName = $('.userName').text();
var LocObj = JSON.parse(UMSLocationDetails);
<!-- Code block for FiberEngineer_Filter controller goes here -->
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="rightFilter" ng-controller="FiberEngineer_Filter as Filter" id="FiberEngineer_Filter">
<!--Note-->
<div class="note">
<span>Note :</span> <i>Billing Cut-off Date : <strong>28</strong></i><i>Scheduler Last Run : <strong>10-09-2019 00:00:00</strong></i>
</div>
<!--Filter-->
<div class="filter">
<a class="showHideFilter"><i class="fa fa-filter" aria-hidden="true"></i> <b>Show Filter</b></a>
<div class="filterContent clearfix">
<div class="filterFields">
<div class="row">
<div class="col-md-10">
<div class="row">
<!-- More HTML code for filtering options goes here -->
</div>
</div>
</div>
</div>
<div class="pdfDownload">
<!-- PDF download button and radio options go here -->
</div>
</div>
</div>
</div>
Note: An issue arises when trying populate data in the FiberEngineer_MaintP
list using the js function getMaintPointList(Values);
.
The console error displayed is:
angular.js:15536 TypeError: SAPExecutive_Service.getMaintPoint is not a function