AngularJS ngIf object has attribute

Viewed 1979

I have an array like this:

{
    selector: "departureDate",
    selectorName: "Departure Date",
    constraints: ["GreaterThan", "LessThan", "Equals", "NotEquals"],
    valueType: "Date"
}, {
    selector: "arrivalDay",
    selectorName: "Arrival day(of week)",
    constraints: ["In"],
    valueType: "ChoiceList",
    valueChoices: ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
}

Now I want to do this in my HTML:

<div class="col-xs-3" *ngIf="prototype.valueChoices">
            <select class="form-control" [(ngModel)]="expression.valueChoice">
                <option *ngFor="#valueChoice of prototype.valueChoices" [value]="constraint">
                    {{ valueChoice }}
                </option>
            </select>
        </div>

Is it possible to check if the object contains an attribute like valueChoices than show the HTML like above. Or is this not the right way to do it?

1 Answers
Related