angular.js - angularjs中如何在指令中添加一个函数(方法)用来关闭或者隐藏指令自己生成的html
淡淡烟草味
淡淡烟草味 2017-05-15 16:55:56
0
1
654

假设有一个hello指令,该指令在ctrlA控制中生成了一个表单dom,在表单上有一个关闭该表单的图标,如何给该图标添加一个函数或者方法用来关闭或者隐藏这个表单dom?

淡淡烟草味
淡淡烟草味

reply all(1)
给我你的怀抱

Operations on the dom structure are generally performed in instructions, so in the template of the construction instruction, which is the HTML string you construct, directly add functions such as '<form>..<icon ng-click="hideform">...</form>' 这样一旦指令生成表单后我们能够在当前指令的link函数中设置一个scope.hideform=function(){}
functions to control the hiding and display of the form. Scope and attr are needed here. You can get it in the link parameter

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template