T
T
timofy2017-07-17 22:25:24
JavaScript
timofy, 2017-07-17 22:25:24

How to bind a function to a tag element in Angular?

There is this HTML code:

<select>
                    <option value="">Date</option>
                    <option value="">Name</option>
                    <option value="">Email</option>
           </select>

and this code in AngularJS controller:
$scope.sortBy = {
        date: function () {

        },
        name: function () {
            console.log($scope.dataFromMySQL);
        },
        email: function () {
            
        }
    };

How can I make sure that when a certain select item is selected, the corresponding function in the controller works? ng-click does not seem to work, how can I bind these functions to these elements?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dark Hole, 2017-07-17
@timofy

https://docs.angularjs.org/api/ng/directive/select

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question