A @Directive is used to add behavior to elements and components in your application. This makes @Directives ideal for behaviors such as "tracking" which don't belong in a Component, but do belong as a behavior in your application. import {Direct…
---------------------------Scope-------------------------------- https://docs.angularjs.org/guide/scope What are Scopes? Scope is an object(是一个数据模型) that refers to the application model. It is an execution context(scope是表达式的执行上下文) for expressions. Sc…
angular自定义指令,意我们可以通过angula自己定义指令,来实现我们的特殊要求,为所欲为,一支穿云箭,千军万马来相见 多少年的老规矩了,先看代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge&…
angular的GitHub Repository Directive Example学习 <!DOCTYPE html> <html ng-app="myApp"> <head> <meta charset="utf-8" /> <title>GitHub Repository Directive Example</title> <script src="http://cdn.…
Directive究竟是个怎么样的一个东西呢?我个人的理解是这样的:将一段html.js封装在一起,形成一个可复用的独立个体,具体特定的功能.下面我们来详细解读一下Directive的一般性用法. var myDirective = angular.module('directives', []); myDirective.directive('directiveName', function($inject) { return { template: '<div></div>',…
Angular作为目前最为流行的前端框架,受到了前端开发者的普遍欢迎.不论是初学Angular的新手,还是有一定Angular开发经验的开发者,了解本文中的12个经典面试问题,都将会是一个深入了解和学习Angular 2的知识概念的绝佳途径. 在文中,我们将会接触到很多Angular 2的重要概念,并附扩展阅读资料和自查小测试,供大家评估自己对Angular的了解程度. Angular 经典面试问题及扩展阅读 1.  请解释Angular 2应用程序的生命周期hooks是什么? Angular…
Angular作为眼下最为流行的前端框架,受到了前端开发者的普遍欢迎.不论是初学Angular的新手.还是有一定Angular开发经验的开发者,了解本文中的12个经典面试问题,都将会是一个深入了解和学习Angular 2的知识概念的绝佳途径. 在文中.我们将会接触到非常多Angular 2的重要概念.并附扩展阅读资料和自查小測试,供大家评估自己对Angular的了解程度. Angular 经典面试问题及扩展阅读 1.  请解释Angular 2应用程序的生命周期hooks是什么? Angular…
AngularJS学习笔记 <!DOCTYPE html> <html ng-app="Demo"> <head> <meta charset="utf-8"> <title></title> </head> <body> <script src="jquery-1.8.3.min.js"></script> <scrip…
Just like in *ngFor, you're able to pass in data into your own structural directives. This is done by declaring the variable using a let statement then passing context into the createEmbeddedView call. We know *ngFor we did like this: *ngFor="let mes…
You need to define a <template> to be able to use it elsewhere in your app as a TemplateRef. You can store these TemplateRefs in a Service and then access them from any @Directive or @Component in your app. We want to create a service and a componen…