Добавляю fastselect
fastselect demo плагин в моем проекте angulrajs. Я не могу передать значения функции $scope.addData
.
Это мой код:
addshop.html:
<form class="form-horizontal" name="addForm" novalidate ng-submit="addData(addForm)">
<div class="col-sm-6">
<label>Sub Directory Name<code>*</code></label>
<select class="multipleSelect" name="category_id" ng-model="formData.category_id" ng-options="category_id.id as category_id.name for category_id in formData.getSubDirectories" ng-required="true" multiple>
</select>
</div>
</form>
<script src="https://rawgit.com/dbrekalo/attire/master/dist/js/build.min.js"></script>
<link rel="stylesheet" href="https://dbrekalo.github.io/fastselect/dist/fastselect.min.css">
<script src="https://dbrekalo.github.io/fastselect/dist/fastselect.standalone.js"></script>
<script>
$('.multipleSelect').fastselect();
</script>
addshop.js:
'use strict';
app.controller('AddShopsController', ['$scope', '$http', '$state', 'authServices', '$sessionStorage', 'webServices', 'utility', '$rootScope', '$stateParams', '$timeout', 'toaster', '$filter', function($scope, $http, $state, authServices, $sessionStorage, webServices, utility, $rootScope, $stateParams, $timeout, toaster, $filter) {
$scope.addData = function(form)
{
console.log($scope.formData.category_id); // selected values
}
$scope.getSubDirectories = function()
{
webServices.get('getSubDirectories').then(function(getData)
{
$rootScope.loading = false;
if (getData.status == 200)
{
$scope.formData.getSubDirectories = getData.data;
} else {
$rootScope.$emit("showerror", getData);
}
//console.log($scope.formData.getSubDirectories);
});
}
$scope.getSubDirectories();
}]);
Изображение:
Приведенное выше изображение я выбрал Jewellery
параметр, я не могу передать Jewellery
значение моей $scope.addData
моей функции.