1

How to concatenate string with scope variable and assign it to ng-model

is there a way ti express this

ng-model="'is'+location.placeName+'Checked'"
1

2 Answers 2

0

You can use ng-bind-model instead of ng-model in this case

ng-bind-model="is{{location.placeName}}Checked"

thanks

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

Comments

0

Finally found the answer randomly in this plunker by ozkary using ng-init

HTML View

<input ng-model="isPlaceChecked" ng-init="isPlaceChecked = checkIfPlaceChecked(location.placeName)"

JS Controller

    $scope.checkIfPlaceChecked = function (placeName) {
        return "is" + placeName + "Checked";
    }

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.