Closed justinbmeyer closed 5 years ago
assets
angular.json
isn't the whole file+2
.. @tehfedaykin , I think that somehow adding <pmo-home>
to app.component.html
so you could see it would be nice."es5BrowserSupport": true
is removed. I think the highlighting could just focus on the object added to assets
and the place-my-order styles added to styles
.only
to the @highlight
like: @higlight XYZ,only
... this will make it so not all of angular.json
is visible.Any time changes are made to the angular.json file, we need to restart our server to catch the new changes.
p0
angular.json has the wrong project namebuild
section of angular.json (instead of the test section)p0
.value
in the .html file.html
app.component.html
right after the components are generated. let folks see the components as soon as possible.dynamic title we can change in an h1 tag
myData
maybe myTitle
?<pmo-home>
first. Move Viewing New Components
up in the "what you need to know" section.<div *ngIf="showMyContent; else showMyFalseTemplate"></div>
ng-class
.. there's no text describing thisngOnInit
function. This would allow ngOnInit
to read a bit better:
ngOnInit(){
setTimeout( () => {
this.restaurants = restaurants.
})
}
src/app/restaurant/restaurant.component.html
as the goal what we are trying to make work in the problem section. <img src="{{restaurant.images.thumbnail | imageUrl}}" width="100" height="100">
. Let them figure out how to get imageUrl
working.P0
- the tests don't pass if <pmo-home>
is in the page. We can have people add tests later? import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
<router-outlet></router-outlet>
be used? This should be app/app.component.htmlWednesday
rla
in <li [ngClass]="{'active' : rla.isActive} ">
?<a routerLink="/about" >About</a>
<mock-url pushstate:from="true"></mock-url>
<script src="//unpkg.com/mock-url@^5.0.0" type="module"></script>
<base-href>
... I'm not sure what "compose" means[x] Wrong highlighting? ... In my previous comment, I expected the following to be highlighted:
const routes: Routes = [
{ path: 'about', component: AboutComponent },
{ path: '**', component: HomeComponent }
]
[ ] Why is the title <base-href>
instead of <base href="PATH">
?
[x] Isn't this just the base element? Are you sure this is Angular: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base ?
[x] Replace the whole file with the following: might want to make it more explicit that everything is being removed.
[x] How to create routes that serve components ... I think we should always say something like ... How to create routes that serve components - you've learned this in the sections above.
src/index.html
instead of app/app.component.html again<a routerLink="/home" routerLinkActive="active">Home</a>
link breaks with:
path that can be static or built dynamically, and
... trails off ....constructor() {
highlightedrouterLinkActive="my-active-class"
and others like [routerLinkActiveOptions]="{exact: true}"
at some point?routerLinkActive="my-active-class"
.... it's crazy that this will know about nested routerLink
s#rla="routerLinkActive"
behaviorh3
s under RouterLinkActive h2
<li routerLinkActive #myroutervariable="routerLinkActive" [ngClass]="{'my-active-class' : myroutervariable.isActive}" >
into multiple lines. Generally I try to keep each attribute on its own line (if there's more than one attribute).Wed, March 27
expect(compiled.querySelector('h1').textContent).toContain('place-my-order.com');
is changed. We should highlight.place-my-order.com
comes from ..npm start
once the proxy is in place .. also verify the proxy.P0
- app.module.ts
needs to be updated to include ImageUrlPipe
. This isn't added until state-city-options
. Wednesday
npm run api
. It asks to double check.
Double check the api is working by running npm run api and navigating to localhost:7070/restaurants. You should see a JSON list of restaurant data. It will be helpful to have a second terminal tab to run the api command from.
HTTPClientModule
docsrestaurant.ts
with it partially filled out (including the export). Something like:
interface Item {}
interface Menu {}
...
export interface Restaurant {}
We should probably have given them the finalized restaurant.service.ts
too ...
Wed March 27
touch
, we might want to tell people to update proxy.conf.json
with the following json.touch proxy.conf.json
isn't type shell?this.users = this.usersService.getUsers();
and probably the <li *ngFor="let user of users">
block to show how the service is used and then displayed ...Cannot read property '__source' of undefined
P0
To Verify Your Solution is Correct The highlighting in src/app/restaurant/restaurant.service.spec.ts seems off. Should it be collapsed? Where does restaurants:ResponseData
come from if it's not imported? Actually .. this code example is broken.Thursday, March 28th
P0
- There's an error when this is complete:
core.js:15714 ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)
[HttpClient]:
StaticInjectorError(Platform: core)[HttpClient]:
NullInjectorError: No provider for HttpClient!
Error: StaticInjectorError(AppModule)[HttpClient]:
StaticInjectorError(Platform: core)[HttpClient]:
NullInjectorError: No provider for HttpClient!
This was because the HttpClientModule
was not a listed import in app.module.ts
HttpClientModule
needs some explanation.P0
- Another error:
ERROR TypeError: Cannot set property 'isPending' of undefined
at restaurant.component.ts:19
restaurants
isn't initialized ... initialized it to
public restaurants: {
value: Restaurant[];
isPending: boolean;
} = {value: [], isPending: false};
"Use Restaurant API data"
?Thur March 28th
Currently this page:
{value, isPending}
(which uses the generic Data<T>
).{value, isPending}
structureI see two main opportunities for improvement:
.html
file isn't updated until later. {value, isPending}
format, but doesn't really introduce it.I see two solutions:
Single Exercise - (easy for us) - Give people the final .html
. Explain how the .restaurants
property should look ({value, isPending}
). Give people the Data<T>
interface. Give people the final .test
. Let them figure everything else out.
Double Exercise - (harder for us) - Split into two exercises. The first works with the existing .html
file. The developers will have to simply write this.restaurants = res.data
. The second one has them changing restaurants
to the new format ({value, isPending}
) and rewriting the .html
file. I'd give people a functional test that tests that the data loads from the service AND that a pending state is shown. The first exercise will only make the first test pass, the second one will make the second test pass.
P0
- <option value="" *ngIf="states.isPending">Loading...</option>
RestaurantComponent.html:6 ERROR TypeError: Cannot read property 'isPending' of undefined
.
I made this work by removing all the <select>
element contents. P0
Given that nothing is produced think this section isn't named right. I think getCities and getStates need to happen here ... or some dummy data needs to be used.I just added some dummy data.
I also kept this code:
this.restaurantService.getRestaurants().subscribe((res: Config) => {
this.restaurants.value = res.data;
this.restaurants.isPending = false;
});
Thurs, March 28th
new FormArray
. Also, could this example show adding something to the users FormArray? I assume angular would add a new row.<input>
s are added dynamically. Might be cool to have a button that adds a checkbox. Then suddenly the serialized data includes the value of the checkbox.import { FormBuilder, FormGroup } from '@angular/forms';
createForm()
function and the call to it in ngOnInit()
.Thurs, March 28th
[x] If you want to show something that actually would leak, change the observable to keep counting and never complete like:
setInterval( ()=> { console.log("incrementing"); observer.next(++count) })
You'd need a button to remove/teardown the component. Comment out the unsubscribe()
and they will see that observable keep counting. Tell people to uncomment the unsubscribe()
to see it stop.
[x] This example creates a subscription, then adds to it. You might want to show the first subscription being created since it is mentioned.
[ ] Exercise: Write service methods to get states and cities - how to use HttpParams: - Example does not work.
[x] How to write a generic Provide a description of what this example shows / what one should learn from it.
[x] How to write a generic This is broken. I don't think it's valid typescript.
[ ] We need to remove a few tests that are no longer relevant to our app's current state .. is there any test actually verifying the behavior? My tests still pass after this change.
P0
- I worked on this a bit. Made it so 1/2 way it just pulls data w/o making it filter values. I highlighted the changes.Config<T>
I think this should be Response
or ResponseData
getRestaurants()
is never called.I updated this so it works. I kept it showing restaurants the whole time. When cities restaurants are changed to require filtering, I made it so it shows those for "IL" / "Chicago"
this.restaurantService.getRestaurants("IL","Chicago").subscribe((res: ResponseData) => {
_Wednesday
HttpParams
set('filter[address.state]', state)
in previous pages.P0
import { ReactiveFormsModule } from '@angular/forms';
not importedAt the Creating a route for restaurant/{{restaurant-slug}} header, the app wasn't working because getUrl
wasn't implemented (but was in the view). I added this earlier. However, restaurant.images.banner
and other restaurant
properties are used in the view. This prevents seeing something from working.
I suggest making a mock restaurant when first creating the restaurant. Or remove using this data from the initial detail.component.html
file. Ideally the apps should work at the end of each section.
P0
shows .css
instead of .less
ngOnInit
explained previously? What about angular lifecycles?src/app/order/app.module.ts
imports menu-items/menu-items.component
but it's not generated. p0
adding the items selected does not work[ ] Show (click)="onClickMe()" taking an argument
[ ] Extra markup for <pmo-menu-items></<pmo-menu-items>
[ ] show how to import event emitter
Exercise:
to be consistent P0
On this step: In your new order component, edit the src/order/order.component.html file to be: I see the following error: . I think this is because RestaurantDetailComponent
does not exist. I think it should still be DetailComponent
. I fixed this everywhere. </ng-template>
</div>
P1
after updating src/app/order/order.component.ts with val.forEach((item: any) => {
, if you uncheck a checkbox, you get the following error: P1
- OrderComponent should create
test is breaking at this step.P0
- Adding <pmo-menu-items></pmo-menu-items>
is shown twice, but without passing the values.P2
- Exercise: Emitting data to parent components's src/app/order/menu-items.component.ts has no highlighting.P0
- uses css instead of .lessP0
- uses css instead of .less
P0
- changes its name from HistoryComponent
to OrderHistoryComponent
and the selector too.Exercise: Export Items and Order interfaces
- There's not a verifiable solution.In 4 hours was able to get through city & state options at an aggressive pace(~10 min per exercise). Pace was too accelerated for most attendees. Attendees with more backend experience struggled with front-end form parts of the content, like dropdowns.
No issues with any of the code samples or spec files, except for one spec file that was collapsed and didn't show a needed import at the top.
2nd half of content was missing a few code examples before requiring knowledge in an exercise.
12-16 hours would be more appropriate for entirety of Angular content.
Meta
Angular
Before you begin
andPrerequisites
sections (DOM and jQuery has an example of these).Why Angular
Building our first app
npm install -g @angular/cli
-> should specify the versionWhich stylesheet format would you like to use?
- does not have an answerless
, example:styleUrls: ['./restaurant.component.less']
angular.json
doesn't auto-compileP1
-npm install -g @angular/cli@7.0.0
=>No matching version found for @angular/cli@7.0.0
npm test
needs to run. Also, we should make sure every file is labeled with its location.