AngularJS 1.6.x Tutorial - 7 - basic components

preview_player
Показать описание
In this video, we refactor our current setup to use a component for the post list that we have.

Social media:
Twitter: @johna2
Рекомендации по теме
Комментарии
Автор

15 minutes to go through playlist and anybody can become angular developer.

kingsandy
Автор

A suggestion: I am noticing through your videos that you usually don't go deeper explaining the structure of angularjs, and so most of the times I am finding really difficult to understand why I have to do something, and not the other way, and if there are other ways why you follow that particular one etc.
I am telling you this since you have this behaviour of maybe going deeper sometimes, like the "camelcase/snakecase" explaination or how angularjs needs to be configured; but I miss the why's, which I think are important to understand what is being done (and i am just referring to angularjs itself, not even much javascript (I think) or such!)
You seem to know really a lot and it's frustrating for me not to understand everything of what's around!

YinYang
Автор

Hey John, the filter: vm.search doesn't seem to work anymore after using a component. How can you get that to work?

BackwardsDaveTV
Автор

Please add more details vedio of components and routing

viharjadhav
Автор

For example, I have a question: I imagine that, with the growth of the app, I will have many components to include in my script.
At that point, there is some way to organize my code better? I should include everything in my index.html file? Doesn't it have an impact on performance?
This code works and it seems pretty interesting and useful, writing a html tag that is in fact pratically a function gave me chills, really, and I am not even realizing the extensibility with the already existing angularjs components!

YinYang
Автор

Thanks for awesome tuts.
can you please upload angularjs with typescript more tuts.

sachinyadav-ofwh
Автор

I have another question; i have tried to change names, but i cannot really figure out in the view, that "posts-list" to what it refers to...

YinYang
Автор

Everything works until this video I do not understand. Even after that sudo command I still have that CORS error.

ms
Автор

Just another to create a component :)

function PostListCtrl(mainSvc) {
var vm = this;

mainSvc.getPosts()
.then(function (resData) {
vm.posts = resData.data;
})
.catch(function (error) {
console.log(error);
});
}

angular.module('myApp')
.component('postList', {
templateUrl: 'post-list/postlist.html',
controller: PostListCtrl,
controllerAs: 'postListCtrl'
});

Janega
Автор

Like the video, but naming controllers "vm" is a bad practice IMO and it gets confusing when you have nested controllers.

Janega
Автор

You did not put a .module() in your component. How is it still working? Also, I am having major troubles with components. Is there any way you can help me? I would really appreciate it. Here is a link to my stack overflow question.

Shingorani