-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(select): Add a sample of select in a form.
- Loading branch information
1 parent
5b2c603
commit fb15102
Showing
6 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
templates/angular/igx-ts/select/select-groups/files/src/app/__path__/__name__.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.select-wrapper { | ||
padding-top: 50ox | ||
padding-top: 50px | ||
} |
13 changes: 13 additions & 0 deletions
13
...lates/angular/igx-ts/select/select-in-form/files/src/app/__path__/__name__.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
11 changes: 11 additions & 0 deletions
11
...lates/angular/igx-ts/select/select-in-form/files/src/app/__path__/__name__.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
34 changes: 34 additions & 0 deletions
34
...es/angular/igx-ts/select/select-in-form/files/src/app/__path__/__name__.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
templates/angular/igx-ts/select/select-in-form/files/src/app/__path__/__name__.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |