I am trying to enable or disable a button in an angularjs application based on whether comparing two text fields with true or false. I gave an example of the code below, and also made it available in the plunter here http://plnkr.co/edit/rzly8hy21048YGzsx2gW?p=preview
As you can see, when you enter a string according to the saved string, the expression evaluates correctly, but the button never becomes available.
Any help would be appreciated.
Here is the HTML
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css" />
<script data-require="angular.js@1.2.x" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js" data-semver="1.2.16"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<button ng-click="updateCounter()">Increment count</button>
<input type="text" ng-model="inputfield">
<input type="button" value="Continue" ng-disabled="{{inputfield !== startertext}}">
<br>startertext: {{startertext}}
<br>nputfield: {{inputfield}}
<br>test: {{inputfield !== startertext}}
</body>
</html>
And the Javascript file below.
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.startertext = 'hello world';
});
source
share