Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Just i want to get the ng-model hidden field value using javascript.
<input type="hidden" name="Latitude" id="sLatitude" ng-model='sLatitude'>
$scope.sLatitude
it took me some time to find out, but I think the answer is
angular.element(YOUR_ANGULAR_ELEMENT_HERE).attr('ng-model');
As an answer you 'll get the value of the ng-model, "sLatitude".
I am leaving it here just in case someone else needs it.
Add a comment
you can get sLatitude value by :
console.log($scope.sLatitude);
If you want that value within scope , just access as $scope.sLatitude
If you want that value outside the scope, document.getElementById("sLatitude").value
document.getElementById("sLatitude").value
You can access by calling:
angular.element(document.getElementById('sLatitude')).scope().sLatitude
You can get the value of Latitude by write this in java script in your controller like this. var latotudeValue = $scope.sLatitude;
You can get the value of Latitude by $scope.
var latitudeValue = $scope.sLatitude;
OR
if you have value attribute in input control then
var latitudeValue = document.getElementsById("sLatitude").value;
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
$scope.sLatitude.