Append html with AngularJS

The code is working correctly, I can insert and delete fields as many times as necessary

How do I load the page to have only the “Incluir” button?

I wish all the code of div = “jumbotron” appears in the DOM just after the action of clicking on the button

Your button is already calling this function, all you need is to set a boolean in there to show/hide the content.

$scope.IncluirICMS = function() {
  $scope.jumbotronOpen = true;
  ...
}

And then use ng-show as you’ve used before.

<div class="jumbotron" ng-show="jumbotronOpen">

This does not work perfectly for two reasons:

1 - When loading the page before clicking insert already have a div = “jumbotron” charged in the DOM, this means that only this hidden.

2 - For the reason already have a div = “jumbotron” to load the page when you click enter, appear twice div = “jumbotron”

There a way to let the div = “jumbotrom” on the site footer for example and clicking the insert button to copy the contents of the div to form?

Clone the contents of the div jumbotron footer to the form I think it’s better because it will not be necessary to insert many concatenations in the html code that is within the javascript

I’m sorry, I don’t understand what you are saying, perhaps you’re wanting to hide/show something within jumbotron div and not the entire thing?

<div class="jumbotron">
  <div ng-show="jumbotronOpen">
  </div>
  ...
</div>

I’m still learning english and write in the forum is also an opportunity, excuse me very wrong

I found now the “ng-if”, hide all contents of the div = “Jumbotron” in console

but “incluir” button is not working

No problem at all. My Portuguese is terrible :wink:

I now understand what you’re trying to do, all that you need to do is to remove the empty object from the initial array to hide that element.

$scope.ICMSs = [];
1 Like

I appreciate your kindness

:sweat_smile: Wow that was so simple

I am greatly thankful :relaxed:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.