Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng-switch #4

Open
ghaiat opened this issue Feb 15, 2016 · 1 comment
Open

ng-switch #4

ghaiat opened this issue Feb 15, 2016 · 1 comment

Comments

@ghaiat
Copy link

ghaiat commented Feb 15, 2016

<span [ngSwitch]="htmlElementType">
            <template ngSwitchWhen="input">
                <label [attr.for]="field.name">{{field.title||field.name}}</label>
                <input id="field.name"  class="form-control" [attr.type]="computeInputSubType()" [(ngModel)]="data[field.name]" [ngFormControl]="form.controls[field.name]" [attr.placeholder]="field.display">
            </template>
            <template ngSwitchWhen="checkbox">
                <div class="checkbox">
                    <label for="field.name">
                        <input id="field.name" class="form-control" type="checkbox" [(ngModel)]="data[field.name]" [ngFormControl]="form.controls[field.name]" >{{field.title||field.name}}
                    </label>
                </div>
            </template>
            <template ngSwitchWhen="option">
                <label [attr.for]="field.name">{{field.title||field.name}}</label>
                <select class="form-control" [(ngModel)]="data[field.name]" [ngFormControl]="form.controls[field.name]" >
                    <option *ngFor="#key of field.values" [value]="key">{{key}}</option>
                </select>
            </template>
            <template ngSwitchDefault>
                <span>Oops! This control type is unknown. Contact the creator</span>
            </template>
        </span>
@ghaiat
Copy link
Author

ghaiat commented Apr 13, 2016

Not supported for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant