File

src/sample/subcomponent/sample-sub.component.ts

Description

this is a sample sub-component

Implements

SampleBase OnChanges

Metadata

providers { : , : (() => ) }
selector ibm-sample-sub

Index

Properties
Methods
Inputs
Outputs

Inputs

foo

input foo

Type: SampleInterface

Outputs

bar

bar emits an Object of some type

$event type: EventEmitter<Object>

Methods

getNextFoo
getNextFoo()

an instance method

Returns : SampleInterface
ngOnChanges
ngOnChanges(changes: )

for changes and initilization that must happen before anything else

Parameters :
Name Type Optional Description
changes
Returns : void

Properties

Public type
type: "single" | "multi"
Type : "single" | "multi"
Default value : single

here's a instance variable that takes a union of "single" | "multi"

import {
	Component,
	Input,
	Output,
	EventEmitter,
	forwardRef,
	OnChanges
} from "@angular/core";

import { SampleBase } from "./../sample-base.class";
import { SampleInterface } from "./../sample.interface";

/**
 * this is a sample sub-component
 */
@Component({
	selector: "ibm-sample-sub",
	template: `
		<span>Hello from a subcomponent</span>
	`,
		// tslint:disable-next-line:no-forward-ref
		providers: [{provide: SampleBase, useExisting: forwardRef(() => SampleSub)}]
})
export class SampleSub implements SampleBase, OnChanges {
	/** input foo */
	@Input() foo: SampleInterface;
	/** bar emits an Object of some type */
	@Output() bar: EventEmitter<Object>;
	/** here's a instance variable that takes a union of "single" | "multi" */
	public type: "single" | "multi" = "single";

	// not every component will need a constructor

	/** for changes and initilization that must happen before anything else */
	ngOnChanges(changes) {
		//
	}

	/** an instance method */
	getNextFoo(): SampleInterface { return; }
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""