Skip to content

Commit

Permalink
feat(select): Add a sample of select in a form.
Browse files Browse the repository at this point in the history
  • Loading branch information
jackofdiamond5 committed Feb 20, 2019
1 parent 5b2c603 commit fb15102
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.select-wrapper {
padding-top: 50ox
padding-top: 50px
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<form>
<div class="select-wrapper">
<igx-select [(ngModel)]="selected" [ngModelOptions]="{standalone: true}">
<igx-select-item *ngFor="let item of items" [value]="item">
{{item}}
</igx-select-item>
</igx-select>
<div class="actions">
<button igxButton (click)="onSubmit()">Submit</button>
</div>
</div>
<p class="output">You selected: {{value}}</p>
</form>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.select-wrapper {
padding-top: 50px;
display: flex;
flex-flow: row;
}

.actions {
display: flex;
flex-flow: column;
padding-left: 20px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { FormsModule } from '@angular/forms';
import { async, TestBed, ComponentFixture } from "@angular/core/testing";
import { NoopAnimationsModule } from "@angular/platform-browser/animations";

import { $(ClassName)Component } from "./$(filePrefix).component";
import { IgxSelectModule, IgxToggleModule } from "igniteui-angular";

describe("$(ClassName)Component", () => {
let component: $(ClassName)Component;
let fixture: ComponentFixture<$(ClassName)Component >;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [$(ClassName)Component],
imports: [
FormsModule,
IgxSelectModule,
IgxToggleModule,
NoopAnimationsModule,
]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent($(ClassName)Component);
component = fixture.componentInstance;
fixture.detectChanges();
});

it("should create", () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Component, ViewChild } from "@angular/core";
import { IgxSelectComponent } from "igniteui-angular";

@Component({
selector: "app-$(filePrefix)",
styleUrls: ["$(filePrefix).component.scss"],
templateUrl: "$(filePrefix).component.html"
})
export class $(ClassName)Component {
@ViewChild(IgxSelectComponent)
public igxSelect: IgxSelectComponent;

public items: string[] = ["Orange", "Apple", "Banana", "Mango"];
public value: string;

public onSubmit() {
this.value = this.igxSelect.value;
}
}
22 changes: 22 additions & 0 deletions templates/angular/igx-ts/select/select-in-form/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { IgniteUIForAngularTemplate } from "../../../../../lib/templates/IgniteUIForAngularTemplate";

class IgxSelectTemplate extends IgniteUIForAngularTemplate {
constructor() {
super(__dirname);
this.components = ["Select In Form"];
this.controlGroup = "Grids & Lists";
this.listInComponentTemplates = true;
this.id = "select-in-form";
this.projectType = "igx-ts";
this.name = "Select In Form";
this.description = "IgxSelect in a form";
this.dependencies = [{
import: [
"IgxSelectModule", "IgxDropDownModule", "IgxFilterModule",
"IgxButtonModule", "IgxToggleModule"
],
from: "igniteui-angular"
}];
}
}
module.exports = new IgxSelectTemplate();

0 comments on commit fb15102

Please sign in to comment.