0

Hı guys.I have started to learn angular.I made an example that contains 2 page.One of them is main.html.The other one(it is popup) is form.html. When i click the button in main.html page, the popup is opened and user enter some inputs.(lacation and tag).There is a button at the bottom which is called add.What i want to do is when the user click the add button,i want to create a thumbnail in the main.html page.Then user can see location and tag inputs in the thumbnail.

How can i add thumbnails automatically?

form(popup).html

<div ng-show="true">
    <label>Location</label>
    <br>

    <input type="text" gm-places-autocomplete ng-model="vm.autocomplete" class="form-control" style="width:300px;" />

    <div ng-show="vm.tags2.length">
        <tags-input ng-model="vm.tags2" placeholder="Selected people" on-tag-removed="tagLocRemoved($tag)" style="width:300px;" on-tag-adding="false">
        </tags-input>
    </div>
    <br>

    <label>Keywords</label>
    <br>

    <tags-input on-tag-added="tagAdded($tag)" on-tag-removed="tagRemoved($tag)" ng-model="vm.remove" style="width:300px;"></tags-input>

    <div>
        <br>
        <button type="button" class="btn btn-default" ng-click="vm.clear()">
            <span class="glyphicon glyphicon-ban-circle"></span>&nbsp;<span>Cancel</span>
        </button>

        <button type="button" class="btn btn-default" ng-click="vm.add()">
            <span class="glyphicon glyphicon-ban-circle"></span>&nbsp;<span>Add</span>
        </button>
    </div>
Mahbubul Islam
  • 998
  • 1
  • 10
  • 24
  • if It's just one thumbnail you have to create it in html and manage it's show/hide by handling the boolean in your function which is bounded with add button. if you want to show a list of cards, you have to do it in ng-repeat then managing the array in your add button function. If you need more help, tell me the specific problem – MohammadJavad Seyyedi Sep 28 '17 at 08:45
  • Thank you your answer. Yes it is just one but maybe the user can opens a new popup and can add a new thumbnail with add button.Thumbnail number is dependent to the user.I added popup page.Location and keywords are added by the user. –  Sep 28 '17 at 08:50
  • so you have to do it in ng-repeat. you have to insert one thumbnail html in your ng-repeat and bind it's data to the values which is handling in add button function. when ever a user add a new value it has to push in array which is ng-repeated – MohammadJavad Seyyedi Sep 28 '17 at 08:54
  • I hold input values in an array.Can i use this array the main.html page.Because array locate in form.controller page. –  Sep 28 '17 at 08:58
  • you can use `event` , it is provided for developers to send data between controllers. you can read about it here : https://stackoverflow.com/questions/14502006/working-with-scope-emit-and-scope-on – MohammadJavad Seyyedi Sep 28 '17 at 09:00

0 Answers0