Skip to content

Commit

Permalink
Add Input component
Browse files Browse the repository at this point in the history
  • Loading branch information
brunolm committed Nov 24, 2017
1 parent 1f5b257 commit 961248c
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/app/tutorials/input/input.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div>
<p>You can use @Input to decorate a field making it accept values sent by the component props.</p>
<p>For example:</p>
<pre>
export class TitleComponent {{ '{' }}
@Input()
message: string;
{{ '}' }}
</pre>

<p>And then you can call the component passing a value for message.</p>
<pre>
&lt;app-title message="Hello world" /&gt;
</pre>

<app-title message="Hello world"></app-title>
</div>
Empty file.
27 changes: 27 additions & 0 deletions src/app/tutorials/input/input.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { InputComponent } from './input.component';
import { SharedModule } from '../../shared/shared.module';

describe('InputComponent', () => {
let component: InputComponent;
let fixture: ComponentFixture<InputComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ InputComponent ],
imports: [SharedModule],
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(InputComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
9 changes: 9 additions & 0 deletions src/app/tutorials/input/input.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Component, Input } from '@angular/core';

@Component({
selector: 'app-input',
templateUrl: './input.component.html',
styleUrls: ['./input.component.scss']
})
export class InputComponent {
}

0 comments on commit 961248c

Please sign in to comment.