随笔分类 - Angular
摘要:Angular 2’s ngModel exposes more than just validity, it even gives you the states of whether the input has been “touched” or changed. This lesson expl
阅读全文
摘要:Inputs using Angular 2’s ngModel automatically apply style classes of .ng-validand .ng-invalid each time the input’s validity changes. These classes a
阅读全文
摘要:The ngModelGroup directive allows you to group together related inputs so that you structure the object represented by the form in a useful and predic
阅读全文
摘要:Forms in Angular 2 are essentially wrappers around inputs that group the input values together into an object and also check that all the inputs are v
阅读全文
摘要:Angular 2’s ngModel provides error objects for each of the built-in input validators. You can access these errors from a reference to the ngModel itse
阅读全文
摘要:In this tutorial we are going to learn how to navigate programmatically (or imperatively) by using the Router API. We are going to learn how to use th
阅读全文
摘要:In this tutorial we are going to learn how to configure the Angular 2 router to cover some commonly used routing scenarios: what if the user goes to t
阅读全文
摘要:You can load resource based on the url using the a combination of ActivatedRouteand Angular 2’s Http service. Since the params and Http are both strea
阅读全文
摘要:The <base href=”/”/> you define will determine how all other assets you plan on loading treat their relative paths. While you’ll most often use / as y
阅读全文
摘要:Angular 2’s ActivatedRoute allows you to get the details of the current route into your components. Params on the ActivatedRoute are provided as strea
阅读全文
摘要:You can easily show the user which route they are on using Angular 2’s routerLinkActive. Whenever a route matches the routerLink defined on the elemen
阅读全文
摘要:Angular 2 lazy loading is a core feature of Angular 2. Lazy loading allows your application to start up faster because it only needs to use the main A
阅读全文
摘要:Angular 2 navigation is configured using the routerLink directive. The routerLink directive behaves like an href’s you are familiar with, but it hooks
阅读全文
摘要:Using the Angular 2 router requires defining routes, passing them in to the RouterModule.forRoot and then importing the configured RouterModule into y
阅读全文
摘要:Angular 2 templates have a special let syntax that allows you to define and pass a context when they’re being generated. We pass in an Object "desc: G
阅读全文
摘要:Angular 2 Components have templates, but you can also create templates inside of your templates using Angular 2 ViewContainer’s createEmbeddedView for
阅读全文
摘要:After the original order is set, you can still leverage methods on the Angular 2 ViewContainer to reorder the components. This is especially helpful w
阅读全文
摘要:By default, when you generate components, they will simply be added to the page in order, one after another. Angular 2 provides methods on the ViewCon
阅读全文
摘要:When you generate Angular 2 components, you’re still able to access the component instance to set properties and invoke methods from the component cla
阅读全文
摘要:You can generate Angular 2 components using a combination of ViewContainer and ComponentFactory, but you must always remember to add the components yo
阅读全文