javascript - How to get an HTML element that called a function in AngularJS ? -


I have an AngularJS instruction, which should be added after the HTML element, which is called it. Element structure can have several nested buttons at different levels of DOM structure.

An instruction is now added to the wrong place instead of a container element in which there is a button, which is called append function.

It looks like:

Enter image details here < / p>

The instructions should be added after a button, which was clicked.

Director:

  app.directive ('recursivefields', function ($ compile, $) Copy: "httpPostController", Template:' & lt; div ng-repeat = ') {Return: {field:' field = 'model:' = model '}, restrict:' e 'nested field in field. Enstandard "" gt; & Lt; Div ng-show = "{{nested field.ICCTA & amp; nested field.ICNU}}" & gt; '+' & Lt; p ng- show = {{nested field. protected}} & gt; {{Nestedfeld .name}} *: & lt; / P & gt; '+' & Lt; P ng- show = {{nested field. ISRAEware}} & gt; {{nestedField.name}}: & lt; / P & gt; '+' & Lt; Input type = "text" ng-model = "model [nest" {+ ParseClassName (type nested field)}} "& gt; '+' & lt; / div & gt; '+ + & lt; / div & Gt; '& Lt; div ng- show = "{{nested field. ISENU}}" & gt; + '& Lt; p ng- show = {{Nestedfeld.ISRAAEFair}} {{Nestedfeld.name}} *: & lt; / P & gt;' + '& lt; p ng-show = {{ Nestedfield.ISUAEArierAir}}> {{Nestedfeld.name}}:  Select '+' & lt; Select ng-model = "Model [Nestedfeld. Name] "ng-change =" getCreateEntityAsText () "class =" form-control "> gt; '+' & lt; option & gt; & lt; / option & gt; '+' & lt; option ng- repeat = "enuValue in nestedField.enumValues" label = {{enumValue.name}}> {{enumValue.ordinal}} & lt; / option & gt; '+' & lt; / select & gt; '+ '& Lt; / div & gt;' + '& lt; div ng- show = "{{NestedField.restResourceName! = 'Null}} "& gt;' + 'accordion pass-other =" one atatime "> gt;' + '& lt; accordion-group heading = {{nested field.name}} - open =" empty- Field model = "createEntityResource" field = "field" & gt; & Lt; / Recursive-fields & gt; '* /' & Lt; Button type = "button" ng-click = "app and directive ()" & gt; "Recursive Field" Director and Lieutenant; / Button & gt; '+' & Lt; / Accordion-group & gt; '+' & Lt; / Accordion & gt; '+' & Lt; / Div & gt; '+' & Lt; / Div & gt; ', link: function (scope, element, ethers) {console.log ("1"); If (scope.field.restResourceName! = Null) {$ http.get (CONSTANTS.EXPLAIN_URL + "/" + scope.field.restResourceName) .vivet (function (data, position) {scope.field.nestedFields = []; Data.content.resource.fields.forEach (function (field) {if (field.isEnum) {$ http.get (CONSTANTS.ENUMS_URL + area. $ Root.parseClassName (field.type)) Success (jobs (data, status ) {Field.enumValues ​​= []; for (index in index index.ontues.values ​​{field.enumValues.push (data.content.values ​​[index])}}}}} scope .field.nestedFields.push (field);})}}} scope .append directive = function () {var recursivefield = $ ("& lt; p & gt; insert me "); recursiveFields.insertAfter (element [0]); $ compilation (recursiveFields) (c Njais);}}}})  is  

Does anyone know what the problem is how to solve the angular?

ngClick is every useful answer highly appreciated and evaluated. Access $ Event which can be passed to your method like this:

& lt; Button type = "button" ng-click = "append directive ($ event)"

In that event there is an asset target .

Check this: And this:

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -