K
K
KOPC18862014-11-26 16:20:55
Angular
KOPC1886, 2014-11-26 16:20:55

How to add elements to html through scope ?

Hello!
How to select an element from autocomplete and add it to html?
Here is where I add

<div id="selectedEditors">
                                <div class="selected_user" ng-repeat="editor in selectedCategory.editors">
                                    <span class="user">{{editor.label}}</span>
                                    <span class="delete_chosen glyphicon glyphicon-remove" ng-click="deleteEditor($index)" title="Удалить"></span>
                                </div>
                            </div>

$scope.selectedEditor = function(user)
            {
                console.log(user);
}

I need to add user to scope.selectedCategory.editors so that the user is displayed in html and then I can pass the array to the server from users.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RedMaker, 2014-12-04
@RedMaker

$scope.selectedEditor = function(user) {
         $scope.selectedCategory.editors.push(user);
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question