0

Is it possible to achieve something along the lines of this

var count = 1;

var blah = $scope.someThing_ + count;

So that blah would be equal to

$scope.someThing_1

I feel like this should work, but it does not seem to be working!

Thanks :)

2

1 Answer 1

0

I'm not sure that it is good idea to store data with dynamically created names of variables, but if you really need in it you could work with properties in js also in this way:

$scope["property_name"]

It means that you could save some value with counter like that:

$scope["someThing_" + count] = "value"

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

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.