asp Tec
asp Tec

Reputation: 39

bind data to ng-model that has parent key

this is my form in view:

<form name="myform" ng-submit="formSubmit(myform)" novalidate>
   <input type="text" name="finalBouquet" ng-model="form.data">
</form>

I want to bind data to "form.data" by this code but is doesn`t work:

$scope.form.data = "my text";

how can I do that?

Upvotes: 0

Views: 38

Answers (2)

SURJEET SINGH Bisht
SURJEET SINGH Bisht

Reputation: 881

First Define :

           $scope.form ={};

then

           $scope.form.data = "my text";

Upvotes: 0

harishr
harishr

Reputation: 18065

do this

$scope.form = {data : "my text" };

Upvotes: 1

Related Questions