Struggling to retrieve the value from ng-model?

Currently, I am utilizing this account due to being logged into Facebook on my other account and not having access to my phone for the verification code process.

On another note, I am struggling to retrieve the value from an ng-model despite numerous attempts. I believe a fresh pair of eyes might be able to help me figure it out by quickly reviewing my code. Cheers...

Html:


<div class="form-group"><label class="col-sm-2 control-label">Established :</label>
<div class="col-sm-10"><input type="text" class="form-control" ng-model="established"></div>
</div>                        

<button class="btn btn-primary " style="float:right;" ng-click="saveApprisalDetails()" type="button"><i class="fa fa-paste"></i> Save</button>


Controller:

        $scope.saveApprisalDetails=function(){
    var urlgetappraisals = './dbscripts/getAppraisalsByRef.php?ref=' + ref
    console.log(urlgetappraisals);
    $http({
        method: 'GET',
        url: urlgetappraisals
    }).success(function(data) {

        $scope.appraisaldetails = data;
        console.log(JSON.stringify(data));

    var url = './dbscripts/saveApprisal.php?id=' + data[0].id;
        url += '&appraisalCompany=' + appraisalCompany;
        url += '&title=' + ref;
        url += '&established=' + $scope.established;

 console.log(url);

            $http({
                method: 'GET',
                url: url
            }).success(function(data) {
            })
    })
}
}
catch(e){}
}

Answer №1

Perhaps consider trying a different approach at the start of the controller:

$scope.view_data = {};

Within the function:

url += '&established=' + $scope.vies_data.established;

And within the view:

<input type="text" class="form-control" ng-model="view_data.established">

I hope this suggestion proves to be helpful =)

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

What could be causing all the flickering in this presentation?

Check out the jQuery slideshow I uploaded on my blog at robertmarkbramprogrammer.blogspot.com/2010/09/jquery-slideshow.html The slideshow is flickering in Chrome but looks fine in IE, Firefox, and even the standalone version. You can view it here: Here i ...

What is the best way to extract values from this PHP script?

I recently delved into the d3 javascript library and successfully created a scatter plot chart that pulls random values from an array. Below is the code snippet: <!DOCTYPE html> <meta charset="utf-8"> <head> <script type="text/ja ...

Having trouble parsing an XML received from AJAX request

I am encountering an issue with the code below: $.ajax({ type: "POST", dataType: "xml", url: getUrl('/GetPeriodicStats/'), data: XML.innerHTML,//some xml, success: function(c) { After receiving the XML data in the clie ...

Modify variables in the child function to be utilized in the parent function

I need to create a scenario where a variable defined in a parent function is modified within a child function and then returned back to the parent as an updated variable. Here is the code I have attempted: let value = 20; console.log(value); // Output: ...

Is there a way to ensure that the 'pointermove' event continues to trigger even after the dialog element has been closed?

I am working on a project that involves allowing users to drag elements from a modal dialog and drop them onto the page. I have implemented a feature where dialog.close() is called once the user starts dragging. This functionality works perfectly on deskto ...

What is the most effective way to import and load three-orbitcontrols?

Has anyone tried implementing the OrbitControls function in conjunction with ReactJS? I have included a snippet of the code below: import React, { Component } from 'react'; import 'tachyons'; import * as THREE from 'react'; im ...

What is the best way to have the sidebar of a webpage slide out over the main body content that is being displayed?

Issue Summary I am experiencing an issue with the positioning of my sidebar, which is initially located 66% offscreen using -translate-x-2/3. The sidebar is meant to be pulled into view onmouseover, however, the main body content remains stuck in place. I ...

What are some strategies for circumventing the need for two switches?

My LayerEditor class consists of two private methods: export class LayerEditor { public layerManager: LayerManager; constructor() { this.layerManager = new LayerManager(this); } private executeCommand() { ...

Creating a Javascript Polling feature in a Ruby on Rails application

I'm completely new to using javascript and I am currently working on implementing polling in a rails application to display a simplified feed of activities from an activity model. I am closely following the Railscast tutorial on polling which can be f ...

PHP and JavaScript: Understanding Variables

I currently have a View containing an Associative Array filled with information on accidents. Users will have the ability to click on a Country. Once clicked, I want to display accident-related data for that specific country. This data is pulled from PHP ...

Executing functions in TypeScript

I am facing an issue while trying to call a function through the click event in my template. The error message I receive is "get is not a function". Can someone help me identify where the problem lies? This is my template: <button class="btn btn-prima ...

Executing Ionic function before application shutdown

Does anyone know of a function that can be triggered when the app is about to exit, close, or go into the background? Essentially any event that indicates "the user has stopped using the app"? In my app, I create a 'user log' that keeps track of ...

When a user clicks a button, modify a section of the URL and navigate to

I've been searching everywhere for a solution to this issue, but I just can't seem to find it. I'm hoping someone here can help me out. In a bilingual store, I need a way to redirect users to the same product on a different domain when they ...

Error encountered in angular.forEach syntax

Can someone help me figure out why my array sum calculation using angular.foreach is resulting in a "syntax error" message? I believe my syntax is correct, as indicated by var sum += value.fare;. Any insights on why this error occurs would be appreciated. ...

Getting the total number of child elements in a web page using Selenium web-driver with Node.js

I've been looking everywhere, but I can't seem to find the answer Here's my HTML code: <form id="search_form_homepage" > ... <div class="search__autocomplete" style="display: block;"> &l ...

Determine how to use both the "if" and "else if" statements in

/html code/ There are 4 textboxes on this page for entering minimum and maximum budget and area values. The condition set is that the maximum value should be greater than the minimum value for both budget and area. This condition is checked when the form i ...

Dealing with the "TypeError: Cannot read property 'style' of undefined" error in material-ui Transitions: A troubleshooting guide

While attempting to incorporate transitions within my react app, I encountered a recurring error whenever I tried to implement any transition module: "TypeError: Cannot read property 'style' of undefined". (anonymous function) node_modules/ ...

Problem with Pathjs routing

Can anyone help with this routing issue I'm having? Path.map("/(:page_1)(/:page_2)/").to(funct); The route is not matching for: /projects/index2/ It matches /anything, but not /anything/anything If you have any ideas, please share! ...

The issue arises when attempting to utilize ExpressJS middleware in conjunction with NextJS Link feature

Incorporating Next with Express routes, I have set up a scenario where /a should only be accessible to authorized individuals, while /b is open to the public. ... other imports... const app = next({ isDev }) const handle = app.getRequestHandler() async f ...

merge two structures to create a unified entity

I have been searching in vain, can you please advise me on how to combine these two simple forms into one? I want it to be like a box with a select option and a button. The challenge for me is merging the two different actions, ".asp", into one script fo ...