I want a list of suggested tags to show beneath an input field only when a user has started typing into the input field. Currently I have this
jade
div.form-group
input#tags.form-control(name="tags", ng-model="query")
div.form-group
ul.suggested-tags
li(ng-repeat="tag in tags | filter:query") {{tag.name}}
and this JS
controller('TagsCtrl', function ($scope) {
$scope.tags = [
{
"name": "Foo",
"id": "foo"
},
{
"name": "Bar",
"id": "bar"
}
]
})
What is the right way to set tags to [] if query is null?