I have a text input that pulls the value of the window.location.href, looks for ?= and strips out the trailing value which is used as the input value. I can't get the validation to check if there is a value after the =, and display an error if there isn't.
The full url it is testing is http://localhost:3000/admin/tagger.html?=1234567, where 1234567 should be the value in the textbox. If there is no numeric value after the =, show an error.
var myApp = angular.module("myApp", []);
myApp.controller("myController", function ($scope, $http) {
$scope.init = function () {
var url = window.location.href;
var accountId = url.substr(url.indexOf("=") + 1);
if ($(".accountNumber").val() !== window.location.href + "?=") {
alert("ERROR");
} else {
$scope.accountNumber = accountId;
}
}
});