随笔分类 -  Angular

摘要:ElementRef: In Angular2 Doc, it suggest to "avoid" using ElementRef. It access DOM directly, can easily be attacked. If we log out the ElementRef, we 阅读全文
posted @ 2016-09-23 02:58 Zhentiw 阅读(4919) 评论(0) 推荐(0)
摘要:You have complete control over the elements you nest inside of your component instance by using selectors to access and rearrange them. Selecting allo 阅读全文
posted @ 2016-09-22 14:47 Zhentiw 阅读(323) 评论(0) 推荐(0)
摘要:You can place content inside of the instance of your component element then manage it inside of the component’s template using ng-content. This proces 阅读全文
posted @ 2016-09-21 14:40 Zhentiw 阅读(200) 评论(0) 推荐(0)
摘要:Each Angular 2 Component can have its own styles which will remained contained inside the component. These isolated styles allow you to add whichever 阅读全文
posted @ 2016-09-21 03:33 Zhentiw 阅读(578) 评论(0) 推荐(0)
摘要:Both Smart Components and Presentation Components receive data from Services in entirely different ways. Smart Components use constructor injection to 阅读全文
posted @ 2016-09-20 19:02 Zhentiw 阅读(205) 评论(0) 推荐(0)
摘要:Services are used to share data between components. They follow a module pattern that allows you to use the data throughout your application so that y 阅读全文
posted @ 2016-09-20 18:51 Zhentiw 阅读(254) 评论(0) 推荐(0)
摘要:In this lesson we will learn several ways to debug an Angular 2 application, including by using Augury and the console. This is especially useful in s 阅读全文
posted @ 2016-09-20 01:30 Zhentiw 阅读(574) 评论(0) 推荐(0)
摘要:Components that you use across multiple applications need to follow a module pattern that keeps them separate from your application logic. This will a 阅读全文
posted @ 2016-09-19 19:59 Zhentiw 阅读(213) 评论(0) 推荐(0)
摘要:The application structure: in app.module.ts: components/home/home.module.ts: 阅读全文
posted @ 2016-09-19 18:16 Zhentiw 阅读(496) 评论(0) 推荐(0)
摘要:First, how to use a build in pipe: Then how to create a custom pipe: Notice here, we use: The reason doing this is because sort() is mutate opreation, 阅读全文
posted @ 2016-09-19 03:56 Zhentiw 阅读(448) 评论(0) 推荐(0)
摘要:When using provider string tokens, there’s a chance they collide with other third-party tokens. Angular has with the concept of opaque tokens, that al 阅读全文
posted @ 2016-09-18 02:52 Zhentiw 阅读(748) 评论(0) 推荐(0)
摘要:Dependecies aren’t always objects created by classes or factory functions. Sometimes, all we really want is inject a simple value, which can be a prim 阅读全文
posted @ 2016-09-18 02:24 Zhentiw 阅读(553) 评论(0) 推荐(0)
摘要:In order to resolve a dependency, Angular’s DI uses type annotations. To make sure these types are preserved when transpiled to ES5, TypeScript emits 阅读全文
posted @ 2016-09-17 03:31 Zhentiw 阅读(337) 评论(0) 推荐(0)
摘要:This lesson discusses when and how to add dependencies, resolved by Angular’s DI, to factory providers. The example used in this lesson builts upon th 阅读全文
posted @ 2016-09-17 03:30 Zhentiw 阅读(272) 评论(0) 推荐(0)
摘要:In this lesson, we discuss how and when to use factory providers, to enable dependencies that shouldn’t be available to Angular’s DI. If you have this 阅读全文
posted @ 2016-09-16 19:42 Zhentiw 阅读(287) 评论(0) 推荐(0)
摘要:In this lesson, we’re going to take a look at how add a class to the providers property of a component creates an actual providers. We’ll learn what a 阅读全文
posted @ 2016-09-16 19:34 Zhentiw 阅读(452) 评论(0) 推荐(0)
摘要:In previous artical, we introduce the how to use *ngFor. The limitation for previous solution to display all the heros is we hard cord all heros in ou 阅读全文
posted @ 2016-09-14 23:13 Zhentiw 阅读(1468) 评论(0) 推荐(0)
摘要:heros.ts: here we can also use: heroes.component.css: 阅读全文
posted @ 2016-09-14 16:11 Zhentiw 阅读(7785) 评论(0) 推荐(0)
摘要:First, What is directive, what is the difference between component and directive. For my understanding, component is something like 'canvas', 'form', 阅读全文
posted @ 2016-09-14 04:57 Zhentiw 阅读(974) 评论(0) 推荐(0)
摘要:The application is simple, to build a color picker: When click the rect box, it will check the color value below and title color will also change. col 阅读全文
posted @ 2016-09-14 01:44 Zhentiw 阅读(2084) 评论(0) 推荐(0)