0

Is there any way that I can get angular variable value as below syntax.?

var iNumber= "$scope.RegionLineNumber"
2
  • Question is unclear Commented Aug 10, 2017 at 16:10
  • what exactly do you want ? Commented Aug 10, 2017 at 16:21

2 Answers 2

1

why you want to do this. If you want to get in string format then you can use $scope.RegionLineNumber.toString();

Sign up to request clarification or add additional context in comments.

2 Comments

Its about getting the value dynamically.------- Eg String x="umber" var iNumber = $scope["RegionLineN"+x]; ----- Hope you get this
Try this var iNumber = $scope[RegionLineN+x];
0

You can use eval (read this and this before)

var iNumber = eval("$scope.RegionLineNumber");

however there's certainly a better way to do that. For example, if you know it's in $scope, just use

var iNumber = $scope["RegionLineNumber"];

Comments

Your Answer

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.

Ask question

Explore related questions

See similar questions with these tags.