basically, you need to add "proxyConfig": "proxy.conf.json" line into "development" section and re-run your server. then the route would be available at localhost:4200/api/donuts
hazartilirot
Lesson 57, timeline 03:05, apart from assets I did the project from scratch. Therefore I didn't have the json-server library. Anyway, do it simple as I did.
Install the cuncurrently library:
npm i concurrently
and after the line:
"db": "json-server --watch db.json --delay 1000",
paste another one:
"concurrently": "concurrently --kill-others \"npm run db\" \"npm run start\""
now, open your terminal and type npm run concurrenlty It should run json-server and then your server.
hazartilirot
Lesson 55, well, I've just checked... you may pass the empty object in this way in donut-single.component.ts
ngOnInit(): void {
this.donut = {}; //TODO: DELETE THE EMPTY OBJECT ONCE IT'S USELESS!
}
it's basically, for testing purpose. Instead of creating an empty object with specified fields (empty fields). it works my way as good as shown in the video.
hazartilirot
Lesson 54, timeline 03:56 - I don't think making id optional in Donut type is a way we need to handle the issue.
A better approach would be to create a new Service:
ng g s admin/services/utils --skip-tests
Then we add a function creating a Random ID (taken from Stockoverflow):
makeid(length: number) {
let result = '';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const charactersLength = characters.length;
let counter = 0;
while (counter < length) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
counter += 1;
}
return result;
}
Lesson 53, timeline 04:35, there is no point in getting our array by read() means. You may get the list out of the array itself. You won't break encapsulation best-practices. That's how it works.
As for the readOne method. I wonder if I can write like this:
{}; will print an empty object. But if you assign it to a real one - it won't complain. I've already checked it out.
hazartilirot
Lesson 49 timeline 06:58 - I don't like the condition IF ELSE. It might have been uncle Robert Martin or someone else. Unfortunately I don't remember exactly the stipulator. But what he actually said is that we need to avoid those blocks with IF and ELSE for the sake of simplicity.
handleSubmit(form: NgForm) {
if (form.invalid) form.form.markAllAsTouched();
this.create.emit(form.value);
form.resetForm();
}
The code does exactly the same, but it's written clearer.
swisse
Hi Admin,
I'm just curious if this has been updated by the author.
Thanks.
CourseHunter Team
swisse
Hi, there was no updates by author in this course
Anonymous
Subtitles?
HEM4NG
Please please please update this one !
CourseHunter Team
HEM4NG
nothing was updated
HEM4NG
CourseHunter Team
Thanks buddy. Did we also get this one?
https://ultimatecourses.com/learn/angular-pro
CourseHunter Team
HEM4NG
https://coursehunter.net/course/angular-pro
HEM4NG
HEM4NG
Sorry my bad. Not updated. Git is showing 6 years ago :(
rmkanoune
Hello Admin,
could please update this code, it is updated to "Angular Basics (v15)" .
Thank you
CourseHunter Team
rmkanoune
HI, you have github links under the player
Anonymous
Здравствуйте, курс обновлен до 15 версии, прошу обновить тоже, спасибо!
Команда внимательно читает ваши комментарии и оперативно на них реагирует. Вы можете спокойно оставлять запросы на обновления или задавать любые вопросы о курсе здесь.
https://ultimatecourses.com/learn/angular-basics
Is Todd that fucked up?)
https://ultimatecourses.com/learn/angular-pro
https://ultimatecourses.com/learn/angular-pro
proxy.conf.json
{
"/api/*": {
"target": "http://localhost:3000",
"secure": false,
"pathRewrite": {
"^/api": ""
},
"logLevel": "debug"
}
}
but what is more importantly, read the manual
https://angular.io/guide/build#proxying-to-a-backend-server
or
https://stackoverflow.com/a/71764796/1521866
basically, you need to add "proxyConfig": "proxy.conf.json" line into "development" section and re-run your server. then the route would be available at localhost:4200/api/donuts
Install the cuncurrently library:
npm i concurrently
and after the line:
"db": "json-server --watch db.json --delay 1000",
paste another one:
"concurrently": "concurrently --kill-others \"npm run db\" \"npm run start\""
now, open your terminal and type npm run concurrenlty It should run json-server and then your server.
ngOnInit(): void {
this.donut = {}; //TODO: DELETE THE EMPTY OBJECT ONCE IT'S USELESS!
}
it's basically, for testing purpose. Instead of creating an empty object with specified fields (empty fields). it works my way as good as shown in the video.
A better approach would be to create a new Service:
ng g s admin/services/utils --skip-tests
Then we add a function creating a Random ID (taken from Stockoverflow):
makeid(length: number) {
let result = '';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const charactersLength = characters.length;
let counter = 0;
while (counter < length) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
counter += 1;
}
return result;
}
In our DonutService we inject our UntilsService
constructor(private utilsService: UtilsService) { }
and finally, we add a generated id to our object we place into a new array:
create(donut: Donut): void {
const id = this.utilsService.makeid(6)
this.donuts = [...this.donuts, {id, ...donut}];
}
As for the readOne method. I wonder if I can write like this:
readOne(donutId: string): Donut {
const foundElement = this.donuts.find(d => d.id === donutId)
return foundElement ? foundElement : {};
}
{}; will print an empty object. But if you assign it to a real one - it won't complain. I've already checked it out.
handleSubmit(form: NgForm) {
if (form.invalid) form.form.markAllAsTouched();
this.create.emit(form.value);
form.resetForm();
}
The code does exactly the same, but it's written clearer.
I'm just curious if this has been updated by the author.
Thanks.
https://ultimatecourses.com/learn/angular-pro
could please update this code, it is updated to "Angular Basics (v15)" .
Thank you