committed by
Igor Minar
parent
344a5ca545
commit
9bbf009dff
+62
-62
@@ -46,7 +46,7 @@ describe('Reactive forms', function() {
|
||||
|
||||
describe('final demo', function() {
|
||||
it('does not select any hero by default', function() {
|
||||
let heroSection = element(by.css('hero-list > div'));
|
||||
let heroSection = element(by.css('app-hero-list > div'));
|
||||
expect(heroSection.isPresent()).toBe(false);
|
||||
});
|
||||
|
||||
@@ -56,7 +56,7 @@ describe('Reactive forms', function() {
|
||||
whirlwindButton.click();
|
||||
let refresh = element(by.css('button'));
|
||||
refresh.click();
|
||||
let heroSection = element(by.css('hero-list > div'));
|
||||
let heroSection = element(by.css('app-hero-list > div'));
|
||||
expect(heroSection.isPresent()).toBe(false);
|
||||
});
|
||||
|
||||
@@ -67,7 +67,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('should show a hero information when the button is clicked', function() {
|
||||
let editMessage = element(by.css('hero-list > div > h3'));
|
||||
let editMessage = element(by.css('app-hero-list > div > h3'));
|
||||
expect(editMessage.getText()).toBe('Editing: Whirlwind');
|
||||
});
|
||||
|
||||
@@ -87,7 +87,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail > p'));
|
||||
let json = element(by.css('app-hero-detail > p'));
|
||||
expect(json.getText()).toContain('Whirlwind');
|
||||
expect(json.getText()).toContain('Anywhere');
|
||||
expect(json.getText()).toContain('Somewhere');
|
||||
@@ -95,7 +95,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('has two disabled buttons by default', function() {
|
||||
let buttons = element.all(by.css('hero-detail > form > div > button'));
|
||||
let buttons = element.all(by.css('app-hero-detail > form > div > button'));
|
||||
expect(buttons.get(0).getAttribute('disabled')).toBe('true');
|
||||
expect(buttons.get(1).getAttribute('disabled')).toBe('true');
|
||||
});
|
||||
@@ -103,7 +103,7 @@ describe('Reactive forms', function() {
|
||||
it('enables the buttons after we edit the form', function() {
|
||||
let nameInput = element(by.css('input[formcontrolname=name]'));
|
||||
nameInput.sendKeys('a');
|
||||
let buttons = element.all(by.css('hero-detail > form > div > button'));
|
||||
let buttons = element.all(by.css('app-hero-detail > form > div > button'));
|
||||
expect(buttons.get(0).getAttribute('disabled')).toBeNull();
|
||||
expect(buttons.get(1).getAttribute('disabled')).toBeNull();
|
||||
});
|
||||
@@ -111,18 +111,18 @@ describe('Reactive forms', function() {
|
||||
it('saves the changes when the save button is clicked', function() {
|
||||
let nameInput = element(by.css('input[formcontrolname=name]'));
|
||||
nameInput.sendKeys('a');
|
||||
let save = element.all(by.css('hero-detail > form > div > button')).get(0);
|
||||
let save = element.all(by.css('app-hero-detail > form > div > button')).get(0);
|
||||
save.click();
|
||||
let editMessage = element(by.css('hero-list > div > h3'));
|
||||
let editMessage = element(by.css('app-hero-list > div > h3'));
|
||||
expect(editMessage.getText()).toBe('Editing: Whirlwinda');
|
||||
});
|
||||
|
||||
it('reverts the changes when the revert button is clicked', function() {
|
||||
let nameInput = element(by.css('input[formcontrolname=name]'));
|
||||
nameInput.sendKeys('a');
|
||||
let revert = element.all(by.css('hero-detail > form > div > button')).get(1);
|
||||
let revert = element.all(by.css('app-hero-detail > form > div > button')).get(1);
|
||||
revert.click();
|
||||
let editMessage = element(by.css('hero-list > div > h3'));
|
||||
let editMessage = element(by.css('app-hero-list > div > h3'));
|
||||
expect(editMessage.getText()).toBe('Editing: Whirlwind');
|
||||
expect(nameInput.getAttribute('value')).toBe('Whirlwind');
|
||||
});
|
||||
@@ -157,7 +157,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('should show a hero information when the button is clicked', function() {
|
||||
let editMessage = element(by.css('hero-list > div > h3'));
|
||||
let editMessage = element(by.css('app-hero-list > div > h3'));
|
||||
expect(editMessage.getText()).toBe('Editing: Bombastic');
|
||||
});
|
||||
|
||||
@@ -172,7 +172,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail > p'));
|
||||
let json = element(by.css('app-hero-detail > p'));
|
||||
expect(json.getText()).toContain('Bombastic');
|
||||
expect(json.getText()).toContain('Smallville');
|
||||
expect(json.getText()).toContain('OH');
|
||||
@@ -180,7 +180,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('has two disabled buttons by default', function() {
|
||||
let buttons = element.all(by.css('hero-detail > form > div > button'));
|
||||
let buttons = element.all(by.css('app-hero-detail > form > div > button'));
|
||||
expect(buttons.get(0).getAttribute('disabled')).toBe('true');
|
||||
expect(buttons.get(1).getAttribute('disabled')).toBe('true');
|
||||
});
|
||||
@@ -188,7 +188,7 @@ describe('Reactive forms', function() {
|
||||
it('enables the buttons after we edit the form', function() {
|
||||
let nameInput = element(by.css('input[formcontrolname=name]'));
|
||||
nameInput.sendKeys('a');
|
||||
let buttons = element.all(by.css('hero-detail > form > div > button'));
|
||||
let buttons = element.all(by.css('app-hero-detail > form > div > button'));
|
||||
expect(buttons.get(0).getAttribute('disabled')).toBeNull();
|
||||
expect(buttons.get(1).getAttribute('disabled')).toBeNull();
|
||||
});
|
||||
@@ -196,18 +196,18 @@ describe('Reactive forms', function() {
|
||||
it('saves the changes when the save button is clicked', function() {
|
||||
let nameInput = element(by.css('input[formcontrolname=name]'));
|
||||
nameInput.sendKeys('a');
|
||||
let save = element.all(by.css('hero-detail > form > div > button')).get(0);
|
||||
let save = element.all(by.css('app-hero-detail > form > div > button')).get(0);
|
||||
save.click();
|
||||
let editMessage = element(by.css('hero-list > div > h3'));
|
||||
let editMessage = element(by.css('app-hero-list > div > h3'));
|
||||
expect(editMessage.getText()).toBe('Editing: Bombastica');
|
||||
});
|
||||
|
||||
it('reverts the changes when the revert button is clicked', function() {
|
||||
let nameInput = element(by.css('input[formcontrolname=name]'));
|
||||
nameInput.sendKeys('a');
|
||||
let revert = element.all(by.css('hero-detail > form > div > button')).get(1);
|
||||
let revert = element.all(by.css('app-hero-detail > form > div > button')).get(1);
|
||||
revert.click();
|
||||
let editMessage = element(by.css('hero-list > div > h3'));
|
||||
let editMessage = element(by.css('app-hero-list > div > h3'));
|
||||
expect(editMessage.getText()).toBe('Editing: Bombastic');
|
||||
expect(nameInput.getAttribute('value')).toBe('Bombastic');
|
||||
});
|
||||
@@ -243,7 +243,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('should show hero information when the button is clicked', function() {
|
||||
let editMessage = element(by.css('hero-list > div > h3'));
|
||||
let editMessage = element(by.css('app-hero-list > div > h3'));
|
||||
expect(editMessage.getText()).toBe('Editing: Magneta');
|
||||
});
|
||||
|
||||
@@ -253,12 +253,12 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail > p'));
|
||||
let json = element(by.css('app-hero-detail > p'));
|
||||
expect(json.getText()).toContain('Magneta');
|
||||
});
|
||||
|
||||
it('has two disabled buttons by default', function() {
|
||||
let buttons = element.all(by.css('hero-detail > form > div > button'));
|
||||
let buttons = element.all(by.css('app-hero-detail > form > div > button'));
|
||||
expect(buttons.get(0).getAttribute('disabled')).toBe('true');
|
||||
expect(buttons.get(1).getAttribute('disabled')).toBe('true');
|
||||
});
|
||||
@@ -266,7 +266,7 @@ describe('Reactive forms', function() {
|
||||
it('enables the buttons after we edit the form', function() {
|
||||
let nameInput = element(by.css('input[formcontrolname=name]'));
|
||||
nameInput.sendKeys('a');
|
||||
let buttons = element.all(by.css('hero-detail > form > div > button'));
|
||||
let buttons = element.all(by.css('app-hero-detail > form > div > button'));
|
||||
expect(buttons.get(0).getAttribute('disabled')).toBeNull();
|
||||
expect(buttons.get(1).getAttribute('disabled')).toBeNull();
|
||||
});
|
||||
@@ -274,18 +274,18 @@ describe('Reactive forms', function() {
|
||||
it('saves the changes when the save button is clicked', function() {
|
||||
let nameInput = element(by.css('input[formcontrolname=name]'));
|
||||
nameInput.sendKeys('a');
|
||||
let save = element.all(by.css('hero-detail > form > div > button')).get(0);
|
||||
let save = element.all(by.css('app-hero-detail > form > div > button')).get(0);
|
||||
save.click();
|
||||
let editMessage = element(by.css('hero-list > div > h3'));
|
||||
let editMessage = element(by.css('app-hero-list > div > h3'));
|
||||
expect(editMessage.getText()).toBe('Editing: Magnetaa');
|
||||
});
|
||||
|
||||
it('reverts the changes when the revert button is clicked', function() {
|
||||
let nameInput = element(by.css('input[formcontrolname=name]'));
|
||||
nameInput.sendKeys('a');
|
||||
let revert = element.all(by.css('hero-detail > form > div > button')).get(1);
|
||||
let revert = element.all(by.css('app-hero-detail > form > div > button')).get(1);
|
||||
revert.click();
|
||||
let editMessage = element(by.css('hero-list > div > h3'));
|
||||
let editMessage = element(by.css('app-hero-list > div > h3'));
|
||||
expect(editMessage.getText()).toBe('Editing: Magneta');
|
||||
expect(nameInput.getAttribute('value')).toBe('Magneta');
|
||||
});
|
||||
@@ -330,7 +330,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('does not select any hero by default', function() {
|
||||
let heroSection = element(by.css('hero-list > div'));
|
||||
let heroSection = element(by.css('app-hero-list > div'));
|
||||
expect(heroSection.isPresent()).toBe(false);
|
||||
});
|
||||
|
||||
@@ -340,7 +340,7 @@ describe('Reactive forms', function() {
|
||||
whirlwindButton.click();
|
||||
let refresh = element(by.css('button'));
|
||||
refresh.click();
|
||||
let heroSection = element(by.css('hero-list > div'));
|
||||
let heroSection = element(by.css('app-hero-list > div'));
|
||||
expect(heroSection.isPresent()).toBe(false);
|
||||
});
|
||||
|
||||
@@ -370,7 +370,7 @@ describe('Reactive forms', function() {
|
||||
expect(address2.city).toBe('Somewhere');
|
||||
});
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail-8 > p'));
|
||||
let json = element(by.css('app-hero-detail-8 > p'));
|
||||
expect(json.getText()).toContain('Whirlwind');
|
||||
expect(json.getText()).toContain('Anywhere');
|
||||
expect(json.getText()).toContain('Somewhere');
|
||||
@@ -427,7 +427,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail-8 > p'));
|
||||
let json = element(by.css('app-hero-detail-8 > p'));
|
||||
expect(json.getText()).toContain('Bombastic');
|
||||
expect(json.getText()).toContain('Smallville');
|
||||
expect(json.getText()).toContain('04501');
|
||||
@@ -475,7 +475,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail-8 > p'));
|
||||
let json = element(by.css('app-hero-detail-8 > p'));
|
||||
expect(json.getText()).toContain('Magneta');
|
||||
});
|
||||
|
||||
@@ -521,7 +521,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('does not select any hero by default', function() {
|
||||
let heroSection = element(by.css('hero-list > div'));
|
||||
let heroSection = element(by.css('app-hero-list > div'));
|
||||
expect(heroSection.isPresent()).toBe(false);
|
||||
});
|
||||
|
||||
@@ -531,7 +531,7 @@ describe('Reactive forms', function() {
|
||||
whirlwindButton.click();
|
||||
let refresh = element(by.css('button'));
|
||||
refresh.click();
|
||||
let heroSection = element(by.css('hero-list > div'));
|
||||
let heroSection = element(by.css('app-hero-list > div'));
|
||||
expect(heroSection.isPresent()).toBe(false);
|
||||
});
|
||||
|
||||
@@ -557,12 +557,12 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail-7 > p'));
|
||||
let json = element(by.css('app-hero-detail-7 > p'));
|
||||
expect(json.getText()).toContain('Whirlwind');
|
||||
expect(json.getText()).toContain('Anywhere');
|
||||
let nameOutput = element(by.css('hero-detail-7 > p ~ p'));
|
||||
let nameOutput = element(by.css('app-hero-detail-7 > p ~ p'));
|
||||
expect(nameOutput.getText()).toContain('Name value: Whirlwind');
|
||||
let streetOutput = element(by.css('hero-detail-7 > p ~ p ~ p'));
|
||||
let streetOutput = element(by.css('app-hero-detail-7 > p ~ p ~ p'));
|
||||
expect(streetOutput.getText()).toContain('Street value: 123 Main');
|
||||
});
|
||||
|
||||
@@ -602,14 +602,14 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail-7 > p'));
|
||||
let json = element(by.css('app-hero-detail-7 > p'));
|
||||
expect(json.getText()).toContain('Bombastic');
|
||||
expect(json.getText()).toContain('Smallville');
|
||||
expect(json.getText()).toContain('04501');
|
||||
expect(json.getText()).toContain('789 Elm');
|
||||
let nameOutput = element(by.css('hero-detail-7 > p ~ p'));
|
||||
let nameOutput = element(by.css('app-hero-detail-7 > p ~ p'));
|
||||
expect(nameOutput.getText()).toContain('Name value: Bombastic');
|
||||
let streetOutput = element(by.css('hero-detail-7 > p ~ p ~ p'));
|
||||
let streetOutput = element(by.css('app-hero-detail-7 > p ~ p ~ p'));
|
||||
expect(streetOutput.getText()).toContain('Street value: 789 Elm');
|
||||
});
|
||||
|
||||
@@ -656,11 +656,11 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail-7 > p'));
|
||||
let json = element(by.css('app-hero-detail-7 > p'));
|
||||
expect(json.getText()).toContain('Magneta');
|
||||
let nameOutput = element(by.css('hero-detail-7 > p ~ p'));
|
||||
let nameOutput = element(by.css('app-hero-detail-7 > p ~ p'));
|
||||
expect(nameOutput.getText()).toContain('Name value: Magneta');
|
||||
let streetOutput = element(by.css('hero-detail-7 > p ~ p ~ p'));
|
||||
let streetOutput = element(by.css('app-hero-detail-7 > p ~ p ~ p'));
|
||||
expect(streetOutput.getText()).toContain('Street value:');
|
||||
});
|
||||
|
||||
@@ -730,11 +730,11 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail-6 > p'));
|
||||
let json = element(by.css('app-hero-detail-6 > p'));
|
||||
expect(json.getText()).toContain('Whirlwind');
|
||||
let nameOutput = element(by.css('hero-detail-6 > p ~ p'));
|
||||
let nameOutput = element(by.css('app-hero-detail-6 > p ~ p'));
|
||||
expect(nameOutput.getText()).toContain('Name value: Whirlwind');
|
||||
let streetOutput = element(by.css('hero-detail-6 > p ~ p ~ p'));
|
||||
let streetOutput = element(by.css('app-hero-detail-6 > p ~ p ~ p'));
|
||||
expect(streetOutput.getText()).toContain('Street value:');
|
||||
});
|
||||
|
||||
@@ -774,11 +774,11 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail-6 > p'));
|
||||
let json = element(by.css('app-hero-detail-6 > p'));
|
||||
expect(json.getText()).toContain('Bombastic');
|
||||
let nameOutput = element(by.css('hero-detail-6 > p ~ p'));
|
||||
let nameOutput = element(by.css('app-hero-detail-6 > p ~ p'));
|
||||
expect(nameOutput.getText()).toContain('Name value: Bombastic');
|
||||
let streetOutput = element(by.css('hero-detail-6 > p ~ p ~ p'));
|
||||
let streetOutput = element(by.css('app-hero-detail-6 > p ~ p ~ p'));
|
||||
expect(streetOutput.getText()).toContain('Street value:');
|
||||
});
|
||||
}); // Bombastic patchValue form
|
||||
@@ -817,11 +817,11 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail-6 > p'));
|
||||
let json = element(by.css('app-hero-detail-6 > p'));
|
||||
expect(json.getText()).toContain('Magneta');
|
||||
let nameOutput = element(by.css('hero-detail-6 > p ~ p'));
|
||||
let nameOutput = element(by.css('app-hero-detail-6 > p ~ p'));
|
||||
expect(nameOutput.getText()).toContain('Name value: Magneta');
|
||||
let streetOutput = element(by.css('hero-detail-6 > p ~ p ~ p'));
|
||||
let streetOutput = element(by.css('app-hero-detail-6 > p ~ p ~ p'));
|
||||
expect(streetOutput.getText()).toContain('Street value:');
|
||||
});
|
||||
|
||||
@@ -867,11 +867,11 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail-5 > p'));
|
||||
let json = element(by.css('app-hero-detail-5 > p'));
|
||||
expect(json.getText()).toContain('address');
|
||||
let nameOutput = element(by.css('hero-detail-5 > p ~ p'));
|
||||
let nameOutput = element(by.css('app-hero-detail-5 > p ~ p'));
|
||||
expect(nameOutput.getText()).toContain('Name value:');
|
||||
let streetOutput = element(by.css('hero-detail-5 > p ~ p ~ p'));
|
||||
let streetOutput = element(by.css('app-hero-detail-5 > p ~ p ~ p'));
|
||||
expect(streetOutput.getText()).toContain('Street value:');
|
||||
});
|
||||
|
||||
@@ -892,7 +892,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('should show header', function() {
|
||||
let header = element(by.css('hero-detail-4 > h3'));
|
||||
let header = element(by.css('app-hero-detail-4 > h3'));
|
||||
expect(header.getText()).toBe('A FormGroup with multiple FormControls');
|
||||
});
|
||||
|
||||
@@ -917,7 +917,7 @@ describe('Reactive forms', function() {
|
||||
expect(checkbox.getAttribute('checked')).toBe(null);
|
||||
});
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail-4 > p'));
|
||||
let json = element(by.css('app-hero-detail-4 > p'));
|
||||
expect(json.getText()).toContain('power');
|
||||
});
|
||||
|
||||
@@ -940,7 +940,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('should show header', function() {
|
||||
let header = element(by.css('hero-detail-3 > h3'));
|
||||
let header = element(by.css('app-hero-detail-3 > h3'));
|
||||
expect(header.getText()).toBe('A FormGroup with a single FormControl using FormBuilder');
|
||||
});
|
||||
|
||||
@@ -950,9 +950,9 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail-3 > p'));
|
||||
let json = element(by.css('app-hero-detail-3 > p'));
|
||||
expect(json.getText()).toContain('name');
|
||||
let validStatus = element(by.css('hero-detail-3 > p ~ p'));
|
||||
let validStatus = element(by.css('app-hero-detail-3 > p ~ p'));
|
||||
expect(validStatus.getText()).toContain('INVALID');
|
||||
});
|
||||
|
||||
@@ -974,7 +974,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('should show header', function() {
|
||||
let header = element(by.css('hero-detail-2 > h3'));
|
||||
let header = element(by.css('app-hero-detail-2 > h3'));
|
||||
expect(header.getText()).toBe('FormControl in a FormGroup');
|
||||
});
|
||||
|
||||
@@ -984,7 +984,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('shows a json output from the form', function() {
|
||||
let json = element(by.css('hero-detail-2 > p'));
|
||||
let json = element(by.css('app-hero-detail-2 > p'));
|
||||
expect(json.getText()).toContain('name');
|
||||
});
|
||||
|
||||
@@ -1005,7 +1005,7 @@ describe('Reactive forms', function() {
|
||||
});
|
||||
|
||||
it('should show header', function() {
|
||||
let header = element(by.css('hero-detail-1 > h3'));
|
||||
let header = element(by.css('app-hero-detail-1 > h3'));
|
||||
expect(header.getText()).toBe('Just a FormControl');
|
||||
});
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'my-app',
|
||||
selector: 'app-root',
|
||||
template: `
|
||||
<div class="container">
|
||||
<h1>Reactive Forms</h1>
|
||||
<hero-detail></hero-detail>
|
||||
<app-hero-detail></app-hero-detail>
|
||||
</div>`
|
||||
})
|
||||
export class AppComponent { }
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'my-app',
|
||||
selector: 'app-root',
|
||||
template: `
|
||||
<div class="container">
|
||||
<h1>Reactive Forms</h1>
|
||||
<hero-list></hero-list>
|
||||
<app-hero-list></app-hero-list>
|
||||
</div>`
|
||||
})
|
||||
export class AppComponent { }
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
<hr>
|
||||
|
||||
<div class="demo">
|
||||
<hero-list *ngIf="demo===final"></hero-list>
|
||||
<hero-detail-1 *ngIf="demo===1"></hero-detail-1>
|
||||
<hero-detail-2 *ngIf="demo===2"></hero-detail-2>
|
||||
<hero-detail-3 *ngIf="demo===3"></hero-detail-3>
|
||||
<hero-detail-4 *ngIf="demo===4"></hero-detail-4>
|
||||
<hero-detail-5 *ngIf="demo===5"></hero-detail-5>
|
||||
<app-hero-list *ngIf="demo===final"></app-hero-list>
|
||||
<app-hero-detail-1 *ngIf="demo===1"></app-hero-detail-1>
|
||||
<app-hero-detail-2 *ngIf="demo===2"></app-hero-detail-2>
|
||||
<app-hero-detail-3 *ngIf="demo===3"></app-hero-detail-3>
|
||||
<app-hero-detail-4 *ngIf="demo===4"></app-hero-detail-4>
|
||||
<app-hero-detail-5 *ngIf="demo===5"></app-hero-detail-5>
|
||||
|
||||
<div *ngIf="demo >= 6 && demo !== final" >
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
<hr>
|
||||
<h2>Hero Detail</h2>
|
||||
<h3>Editing: {{selectedHero.name}}</h3>
|
||||
<hero-detail-6 [hero]=selectedHero *ngIf="demo===6"></hero-detail-6>
|
||||
<hero-detail-7 [hero]=selectedHero *ngIf="demo===7"></hero-detail-7>
|
||||
<hero-detail-8 [hero]=selectedHero *ngIf="demo===8"></hero-detail-8>
|
||||
<app-hero-detail-6 [hero]=selectedHero *ngIf="demo===6"></app-hero-detail-6>
|
||||
<app-hero-detail-7 [hero]=selectedHero *ngIf="demo===7"></app-hero-detail-7>
|
||||
<app-hero-detail-8 [hero]=selectedHero *ngIf="demo===8"></app-hero-detail-8>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Hero } from './data-model';
|
||||
import { HeroService } from './hero.service';
|
||||
|
||||
@Component({
|
||||
selector: 'my-app',
|
||||
selector: 'app-root',
|
||||
templateUrl: './demo.component.html'
|
||||
})
|
||||
export class DemoComponent {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { FormControl } from '@angular/forms';
|
||||
// #enddocregion
|
||||
|
||||
@Component({
|
||||
selector: 'hero-detail-1',
|
||||
selector: 'app-hero-detail-1',
|
||||
templateUrl: './hero-detail-1.component.html'
|
||||
})
|
||||
// #docregion v1
|
||||
|
||||
@@ -5,7 +5,7 @@ import { FormControl, FormGroup } from '@angular/forms';
|
||||
// #enddocregion imports
|
||||
|
||||
@Component({
|
||||
selector: 'hero-detail-2',
|
||||
selector: 'app-hero-detail-2',
|
||||
templateUrl: './hero-detail-2.component.html'
|
||||
})
|
||||
// #docregion v2
|
||||
|
||||
@@ -5,7 +5,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
// #enddocregion imports
|
||||
|
||||
@Component({
|
||||
selector: 'hero-detail-3',
|
||||
selector: 'app-hero-detail-3',
|
||||
templateUrl: './hero-detail-3.component.html'
|
||||
})
|
||||
// #docregion v3
|
||||
|
||||
@@ -5,7 +5,7 @@ import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
// #enddocregion imports
|
||||
|
||||
@Component({
|
||||
selector: 'hero-detail-3',
|
||||
selector: 'app-hero-detail-3',
|
||||
templateUrl: './hero-detail-3.component.html'
|
||||
})
|
||||
// #docregion v3a
|
||||
|
||||
@@ -7,7 +7,7 @@ import { states } from './data-model';
|
||||
// #enddocregion imports
|
||||
|
||||
@Component({
|
||||
selector: 'hero-detail-4',
|
||||
selector: 'app-hero-detail-4',
|
||||
templateUrl: './hero-detail-4.component.html'
|
||||
})
|
||||
// #docregion v4
|
||||
|
||||
@@ -5,7 +5,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { states } from './data-model';
|
||||
|
||||
@Component({
|
||||
selector: 'hero-detail-5',
|
||||
selector: 'app-hero-detail-5',
|
||||
templateUrl: './hero-detail-5.component.html'
|
||||
})
|
||||
// #docregion v5
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Hero, states } from './data-model';
|
||||
////////// 6 ////////////////////
|
||||
|
||||
@Component({
|
||||
selector: 'hero-detail-6',
|
||||
selector: 'app-hero-detail-6',
|
||||
templateUrl: './hero-detail-5.component.html'
|
||||
})
|
||||
// #docregion v6
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Address, Hero, states } from './data-model';
|
||||
// #enddocregion imports
|
||||
|
||||
@Component({
|
||||
selector: 'hero-detail-7',
|
||||
selector: 'app-hero-detail-7',
|
||||
templateUrl: './hero-detail-5.component.html'
|
||||
})
|
||||
// #docregion v7
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Address, Hero, states } from './data-model';
|
||||
// #enddocregion imports
|
||||
|
||||
@Component({
|
||||
selector: 'hero-detail-8',
|
||||
selector: 'app-hero-detail-8',
|
||||
templateUrl: './hero-detail-8.component.html'
|
||||
})
|
||||
// #docregion v8
|
||||
|
||||
@@ -10,7 +10,7 @@ import { HeroService } from './hero.service';
|
||||
|
||||
// #docregion metadata
|
||||
@Component({
|
||||
selector: 'hero-detail',
|
||||
selector: 'app-hero-detail',
|
||||
templateUrl: './hero-detail.component.html'
|
||||
})
|
||||
// #enddocregion metadata
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
</nav>
|
||||
|
||||
<div *ngIf="selectedHero">
|
||||
<hero-detail [hero]="selectedHero"></hero-detail>
|
||||
<app-hero-detail [hero]="selectedHero"></app-hero-detail>
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
<h2>Hero Detail</h2>
|
||||
<h3>Editing: {{selectedHero.name}}</h3>
|
||||
<!-- #docregion hero-binding -->
|
||||
<hero-detail [hero]="selectedHero"></hero-detail>
|
||||
<app-hero-detail [hero]="selectedHero"></app-hero-detail>
|
||||
<!-- #enddocregion hero-binding -->
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Hero } from './data-model';
|
||||
import { HeroService } from './hero.service';
|
||||
|
||||
@Component({
|
||||
selector: 'hero-list',
|
||||
selector: 'app-hero-list',
|
||||
templateUrl: './hero-list.component.html'
|
||||
})
|
||||
export class HeroListComponent implements OnInit {
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- #docregion -->
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Hero Form</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<!-- #docregion bootstrap -->
|
||||
<link rel="stylesheet" href="https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css">
|
||||
<!-- #enddocregion bootstrap -->
|
||||
|
||||
<!-- Polyfills for older browsers -->
|
||||
<script src="node_modules/core-js/client/shim.min.js"></script>
|
||||
<script src="node_modules/core-js/client/shim.min.js"></script>
|
||||
|
||||
<script src="node_modules/zone.js/dist/zone.js"></script>
|
||||
<script src="node_modules/reflect-metadata/Reflect.js"></script>
|
||||
@@ -25,7 +23,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<my-app>Loading...</my-app>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -1,31 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- #docregion -->
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Hero Form</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<!-- #docregion bootstrap -->
|
||||
<link rel="stylesheet" href="https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css">
|
||||
<!-- #enddocregion bootstrap -->
|
||||
|
||||
<!-- Polyfills for older browsers -->
|
||||
<script src="node_modules/core-js/client/shim.min.js"></script>
|
||||
|
||||
<script src="node_modules/zone.js/dist/zone.js"></script>
|
||||
<script src="node_modules/reflect-metadata/Reflect.js"></script>
|
||||
<script src="node_modules/systemjs/dist/system.src.js"></script>
|
||||
|
||||
<script src="systemjs.config.js"></script>
|
||||
<script>
|
||||
System.import('main.js').catch(function(err){ console.error(err); });
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<my-app>Loading...</my-app>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
import { AppModule } from './app/app.module'; // just the final version
|
||||
import { DemoModule } from './app/demo.module'; // demo picker
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(DemoModule); // (AppModule);
|
||||
import { AppModule } from './app/app.module'; // just the final version
|
||||
import { DemoModule } from './app/demo.module'; // demo picker
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(DemoModule);
|
||||
|
||||
Reference in New Issue
Block a user