Reputation: 7
I am new to angularjs.I have an autocomplete tag in my html page.I need to store the value selected in a variable so that it can be sent to a database. Suggest a way to do it?
js
var app = angular.module("myApp",
['ui.bootstrap','ui.utils','ngTagsInput','ngMaterial', 'ngMessages',
'material.svgAssetsCache'
]);
app.controller("myCtrl",function($scope, $http, $mdDialog) {
$scope.tags = [];
Upvotes: 0
Views: 314
Reputation: 62
HTML
<tag-manager tags="tags"
autocomplete="allTags"
caption="Select tag "> </tag-manager>
JS
var app = angular.module("myApp",['ui.bootstrap','ui.utils','ngTagsInput','ngMaterial', 'ngMessages',
'material.svgAssetsCache']);
app.controller("myCtrl",function($scope, $http, $mdDialog) {
$scope.tags = [];
$scope.allTags = ['item1','item2','item3','item4'];
});
Here selected items will get stored in $scope.tags
and this can be passed to your $http
call.
Upvotes: 3