1

Hi I am new to Angular Js. I have a model like below

$scope.data = {
            FocusOn: "",
            Filters: [
                {
                    FilterName: "",
                    FilterValue: ""
                }
            ],
            Range: {
                From: "",
                To: ""
            }
        }

Below is my simple HTML,

<select ng-model="data1.Filters.FilterName" ng-options="day for day in days"></select>
                <input type="text" ng-model="data1.Filters.FilterValue"/>
                <button ng-click="addField()">Add Field</button>

JS is like below

$scope.data.Filters.push(data1);

But it is not pushed into the arrary. What went wrong and How to use complex models in Angular Js.

Can any one help me?

Thanks,

1 Answer 1

1

here http://jsfiddle.net/U3pVM/10708/

Use

$scope.data.Filters.push($scope.data1);

data1 also lies in the scope of the controller.

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.