Skip to content

Latest commit

 

History

History
90 lines (70 loc) · 1.62 KB

checkbox.md

File metadata and controls

90 lines (70 loc) · 1.62 KB

Checkbox Component

◀️ Back to main page

Usage

HTML

<!--
This simple HTML tag at below is all you need to use this feature.
-->
<works-checkbox
    color="{normal | default | force | primary | cobalt | notice | alert | danger | success}"
    type="{type: string [=checkbox]}"
    id="{id: string}"
    name="{name: string}"
    title="{title: string}"
    disabled="{disabled | true | false}"
    checked="{checked | true | false}"
    readonly="{readonly | true | false}"
    required="{required | true | false}"
    value="value: string"
    ngModel="ngModel"
>
</works-checkbox>

Events

<works-checkbox
    (update)="onUpdate(event: homeworks.Event)"
>
</works-checkbox>
  • update

    This event will be called when the spinner element's change occurs.

EventObject

  • homeworks.Event

    This object is the global event model used for everything in homeworks.

    All update events will be passed this object as a parameter.

Typescript Definition

interface Event {
    element: JQuery;
    value: string;
    checked?: boolean;
}

Example

HTML

<works-checkbox id="homeworks-checkbox" class="homeworks-checkbox"
    [(ngModel)]="checkboxValue"
    color="primary"
    (update)="changesOccured($event);"
    value="Hello World!"
>
</works-checkbox>

Typescript

@Component({
    selector: 'example',
    templateUrl: 'templates/example'
})
export class Example {
    public checkboxValue: string;

    ngOnInit() {    
    }

    changesOccured(value: homeworks.Event) {
        console.log('value', value);
    }
}