Fastselect不与Angularjs一起使用传递值

时间:2019-01-07 08:23:21

标签: javascript jquery angularjs tags multiple-select

正在我的angulrajs项目中添加 import React from 'react'; const styles = { backgroundColor: "#EF3829", color: "#fff", borderRadius: "0px" } export const TYPES = { PRIMARY: 'btn-primary', WARNING: 'btn-warning', DANGER: 'btn-danger', SUCCESS: 'btn-success', } export const Button = (props) => ( <button onClick={props.onClick} style={styles} className={ props.buttonType || TYPES.PRIMARY } > {props.label} </button> ); fastselect demo插件。我无法将值传递给fastselect函数。

这是我的代码:

addshop.html:

$scope.addData

addshop.js:

<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>

图片:

enter image description here

  

上面的图片我选择了'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函数。

0 个答案:

没有答案