The dropdown list in angularjs is failing to populate with options

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

Answer №1

Following a discussion about the topic in the chat, the final objective was to populate the dropdown with the contents of UMSLocationDetails.

We made the following changes:

var LocObj = JSON.parse(UMSLocationDetails);

was updated to a scoped variable:

$scope.MaintP = JSON.parse(UMSLocationDetails);
$scope.SelectedMaintP = $scope.MaintP[0];

The HTML code was modified to:

<select class="form-control" ng-options="value.LocationID for (key, value) in MaintP" ng-model="SelectedMaintP" id="FiberEngineer_MaintP"></select>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Challenges Encountered When Working with Date Fields in Kendo JS Grid

We are facing an unusual issue with the Kendo UI Grid on our production site. Some users are experiencing date fields showing as null in Google Chrome, while they appear correctly in private browsing mode and other browsers like IE and MSEdge. We have bee ...

Attempting to superimpose a CSS triangle arrow onto a Google Map

I'm currently working on incorporating a CSS arrow on top of a Google map as a design element. The concept involves a horizontal stripe with a downward arrow placed halfway through, and I aim to have this arrow overlay the Google map. Here is a snipp ...

Conceal a div element only if it is nested within a particular div class

I have a question about hiding a specific div within another div. Here is the scenario: <div class="xp-row xp-first-row"> <div class="social-buttons"> Some Content Here </div> </div> The goal is to hi ...

Add a script tag to every image in my HTML at once using C#

Managing a site with a thousand images can be overwhelming, especially when trying to add a script tag like <%=Settings.MyDomain%> to each one. I'm looking for a more efficient way to accomplish this task without spending hours on manual labor. ...

Is there a way to make elasticX() and elasticY() only affect the upper bound in dc.js?

One question I have regarding my bubbleChart in dc.js is related to the x-axis. I want the count on the x-axis to always start at 0, but have an upper bound that adjusts based on the range I am looking at. Currently, when I use .elasticX(true), both the up ...

Access the data within a jsonArray using Cypress

I'm dealing with a test.json file that contains a jsonArray [{ "EMAIL": "email_1", "FIRST_NAME": "Daniel" }, [{ "EMAIL": "email_2", "FIRST_NAME": "John" }] ] I'm trying to figure out how to use cypre ...

Having Trouble with Gulp and AutoPrefixer Integration

I have integrated Gulp into my project and am looking to utilize the autoprefixer feature. Here is a glimpse of my current gulp file: // Including gulp var gulp = require('gulp'); // Including necessary plugins var concat = require('gulp-c ...

Setting a timeout from the frontend in the AWS apigClient can be accomplished by adjusting the

I am currently integrating the Amazon API Client Gateway into my project and I have successfully set up all the necessary requests and responses. Now, I am trying to implement a timeout feature by adding the following code snippet: apigClient.me ...

The search results from the autocomplete feature of the Spotify API appear to be missing

Exploring the Spotify API - I am attempting to implement an autocompletion feature using jQuery for a field that suggests artists as users type. Here is what I have so far: HTML: <input type="text" class="text-box" placeholder="Enter Artist" id="artis ...

Mongoose retrieves the entire document, rather than just a portion of it

I'm currently experiencing an issue with my mongoose query callback from MongoDB. Instead of returning just a specific portion of the document, the code I'm using is returning the entire document. I have verified that in the database, the 'p ...

Creating a new object through manipulation of existing objects

In my attempt to transform an existing object into a new object structure, I am facing some challenges. Here is the current data set: const jsonStructure = { "a11/a22/animations": "snimations", "a11/a22/colours": "sl/colours", "a11/a22/fonts" ...

transferring scoped model information to the controller

When using AngularJS, my view is structured like this: <div class="sli1" ng-init="values=[10,20,30,40,50]" <div class="sli2" ng-init="values2=[10,20,30,40,50]" I am attempting to send the initial data models back to the controller for retrieva ...

What are some creative ways to enhance the appearance of a deactivated radio button?

In a table cell, I have a set of radio buttons with a background color that differs from the rest of the page. At times, based on another input, I need to disable certain radio buttons. When a radio button is disabled, its interior color blends with the t ...

implement the use of $rootScope within my custom directive

Can anyone help with using $rootScope inside a directive I created? This directive has an isolated scope, which I can't remove for various reasons. I attempted to inject $rootScope into my directive without success. Here's the code snippet of the ...

Encountered an Error: UpdateCommand is not a valid constructor - AWS SDK v3 when running unit tests with Jest in Node.js

Every time the unit test reaches the point where it calls the UpdateCommand from @aws-sdk/lib-dynamodb, I encounter an error saying "TypeError: UpdateCommand is not a constructor". I suspect that there might be an issue with the mock. I'm unsure of ho ...

What could be causing my col-8 to not align perfectly in the center of the grid system?

Recently, I've been delving into tutorials on how to utilize bootstrap4 and have been experimenting with the grid system. However, I've encountered an issue where my layout is not aligned in the center as intended. Here's a snippet of my cod ...

HTML/CSS Top Bar: Position two contents at opposite ends of the top bar

I am attempting to design a top bar with the following layout Tel:4949494949 social media icons In the center, I want to display contact information and on the right side, my social media icons. However, ...

What is the method to generate an array of values using a single attribute in GeoJSON data?

Note: After reviewing some possible solutions mentioned in this thread, I found that .map is the perfect fit for what I need, which was not covered in the original post. Thomas's response below addresses my specific requirement. In JavaScript, how ca ...

Potential issue with Jhipster: loading of data could be experiencing delays

I've encountered an issue with getting my chart to display properly. I am working on creating a chart using ng2-charts, where I retrieve data from a service and then display it on the chart. The problem arises when the data is not correctly displayed ...

Is there a way to connect a CSS external file that is saved on Dropbox?

Is it possible to link an external CSS file stored in Dropbox with HTML? I have followed all the instructions I could find online, including clicking and pressing "Copy Dropbox Link" to generate an href link. However, it doesn't seem to be working. ...