0

I'm creating a custom section and in one of my controllers I am sucessfully creating an Arrary of propertyeditor objects.

In my view this is working

<umb-property property="vm.propertEditors[0]" ng-if="!vm.isNew">
    <umb-editor model="vm.propertEditors[0]"></umb-editor>
</umb-property>

<umb-property property="vm.propertEditors[1]" ng-if="!vm.isNew">
    <umb-editor model="vm.propertEditors[1]"></umb-editor>
</umb-property>

<umb-property property="vm.propertEditors[2]" ng-if="!vm.isNew">
    <umb-editor model="vm.propertEditors[2]"></umb-editor>
</umb-property>

But What I really want to do is look through, now I know how I can do this is JS for loop, but I'm pretty sure there must be a angular way of doing it, I'm still getting to grips with Angular so please forgive my niavity.

1 Answer 1

1

In Angularjs, you can loop through an array using ng-repeat. For example:

<umb-property ng-repeat="editor in vm.propertEditors" property="editor" ng-if="!vm.isNew">
    <umb-editor model="editor"></umb-editor>
</umb-property>

For more information, you can find the ng-repeat documentation here: https://docs.angularjs.org/api/ng/directive/ngRepeat

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.