angular.js - How to add a function (method) in a directive in angularjs to close or hide the html generated by the directive itself
淡淡烟草味
淡淡烟草味 2017-05-15 16:55:56
0
1
704

Suppose there is a hello instruction, which generates a form dom in the ctrlA control. There is an icon on the form to close the form. How to add a function or method to the icon to close or hide the form 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