The value of the view variable in AngularJS remains stagnant and does not update

Hello there, I am just starting to explore Angularjs. Here is the code snippet that I have been working on :

.html file :

<!DOCTYPE html>
<html ng-app="showcase.angularWay.dataChange">
    <head>
        <script src='js/jquery-1.11.3.min.js'></script>
        <script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js'></script>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular-resource.min.js"></script>
        <script src='js/main.js'></script>
    </head>
    <body>
        <div ng-controller="AngularWayChangeDataCtrl as showCase">
            <input type='text' value="{{showCase.demo}}" />
            {{showCase.demo}}
        </div>
    </body>
</html>

.js file :

angular.module('showcase.angularWay.dataChange', ['ngResource'])
.controller('AngularWayChangeDataCtrl', AngularWayChangeDataCtrl);

function AngularWayChangeDataCtrl($scope) 
{
    var vm = this;
    vm.demo = "hello";
}

Output

Although I noticed that when I input new text in the field, it doesn't update the previously displayed text. Any ideas on how to resolve this would be greatly appreciated. (as seen in the attached image).

Answer №1

You failed to specify the model

Here is an example

<input type='text' ng-model="showCase.demo" />

DEMO

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

Updating the @mui/x-data-grid table dynamically upon fetching new data

Seeking assistance regarding updating data in the DataGrid component from the @mui/x-data-grid module within a React application. Specifically, I am facing challenges in refreshing the table after retrieving data from an API using react-query. Despite succ ...

How can I verify if an unsupported parameter has been passed in a GET request using Express/Node.js?

Within my node.js backend, there is a method that I have: app.get('/reports', function(req, res){ var amount = req.param('amount'); var longitude = req.param('long'); var latitude = req.param('lat'); var di ...

Tips for incorporating a time interval in every iteration of a for loop

I am attempting to display each word of a given text string on the screen at 60-second intervals. After some trial and error, here's what I have come up with: let text = "Aliquam bibendum nulla et ligula vehicula semper. Nulla id posuere lorem, ac di ...

Modifying the background color and linking it to a different class in Android Studio: A step-by-step guide

Recently, I developed a settings feature for my project that allows users to change the background color. However, I noticed that when I return to the home page, the settings are not saving or syncing properly. Any suggestions on how I can sync this info ...

The model of a controller in an isolate directive is not able to be accessed in the view

!!!!!!!!!! Outdated Query Take a look at the code (Not Current). The standalone directive with template is functioning, but the one utilizing it in the display isn't. The Latest Inquiry I am using the same plunk and I have followed @Andrew Eisenb ...

Discovering the power of ng-change in an Angular typeahead search functionality

I am facing an issue with displaying the result list when searching for users on key press using customTemplate.js. The list is not showing up after the first key press. Below is the code I am using: <input type="text" placeholder="Search people here ...

Issue - The command 'bower install' terminated with Exit Status 1

During my journey through the angular-phonecat tutorial, a frustrating error popped up right after I executed the npm install command: I even checked the log file, but it just echoed the same error message displayed in the console. What's the piece o ...

Guide to switching accordion with Javascript and jquery

Currently, I am facing an issue with my accordion where it does not toggle as expected. Ideally, when I click on the same accordion header, it should close along with opening a new one. While clicking on a different header closes the previous one successfu ...

Why does TypeScript not generate an error if props are not passed to a functional component?

How does TypeScript handle not passing down props to a functional component without throwing an error? Consider the following code snippet: interface Props{ id: string; className?: string; } export const Buttons: React.FC<Props> = () => { r ...

Automatically insert hyphens in numerical entries for enhanced readability

I have a form with multiple fields that require filtering, such as an SSN field. Currently, I am validating that the user has entered the correct pattern and displaying an error message if necessary. However, users need to input the hyphens themselves. I ...

AngularJS's $http.get method returns an object type of object

I'm new to using AngularJS and I'm attempting to fetch sample data from a MySQL database and display it on my view. I am trying to utilize $http.get in my code to retrieve the data. Below is my Angular code: Angular Code angular .module('sa ...

When making an API request, the response includes the body of the data, however, the specific properties cannot be

I've encountered an unusual bug while using the Mapbox geocoding API. const geocode = async (address, callback) => { const url = `https://api.mapbox.com/geocoding/v5/mapbox.places/${address}.json?access_token=token&limit=1` try { ...

Service dependency injection error encountered in the controller implementation

After creating a service and attempting to inject dependency into the controller, an error is being displayed: angular.js:12477 Error: [$injector:unpr] Unknown provider: ResultProvider <- Result <- ToolbarController http://errors.angularjs.org/1.4.7 ...

Exploring the intricacies of handling exceptions in the service layer with Spring and Angular JS

Our team of developers is currently working on an application that utilizes jasper-reports 6.2.0, spring-mvc 3.2.14, java-ee-7, tomcat 8, and angularjs in the front-end. All our rest requests are made using ajax. The application is designed to receive JSO ...

What do you mean by "ngDrive not defined?"

I have a question related to a previous discussion on defining gapi in an Angular controller that was posted yesterday. After being directed to the ngDrive git repository (https://github.com/pinoyyid/ngDrive) by user pinoyyid, I encountered an error while ...

I would appreciate your assistance with the hide button

Is there a way to hide a button after clicking on it? I would greatly appreciate your help! ...

header that sticks with irregular motion

Currently in the process of designing a website, I've run into an issue where whenever I scroll with my sticky header, the page automatically jumps to the bottom of the next element. Does anyone have any insights on what might be causing this odd beha ...

Displaying error message on a MEAN stack web application

I'm pretty new to the MEAN stack and I must say, I'm learning a ton. Currently, my challenge is to display an error message on my page when a user is not authorized to access the website. On the page, there's a button that redirects you to t ...

Issue with Three.js failing to display textures

I'm a beginner with three.js and I'm struggling to get my texture to render properly in my scene. Despite following the documentation closely, all I see is a blank canvas with no errors in the console. Can anyone offer any guidance on why my code ...

Learn the process of uploading images and storing them in a database with React

Currently in the process of creating a profile page for my website using MERN stack. I'm wondering about the best way to upload an image from a local machine, save it in the database, and display it on the profile page. ...