fixed multiple choice field
This commit is contained in:
parent
e8d8e0e61f
commit
220643de1e
|
@ -25,7 +25,7 @@
|
|||
"ref" : "origin/master",
|
||||
"repo" : "git@github.com:whitef0x0/tellform.git",
|
||||
"path" : "/opt/deploy",
|
||||
"post-deploy" : "npm install && pm2 startOrRestart ecosystem.json --env production",
|
||||
"post-deploy" : "npm install && pm2 startOrGracefulReload ecosystem.json --env production",
|
||||
"env" : {
|
||||
"NODE_ENV": "production",
|
||||
"BASE_URL": "admin.tellform.com"
|
||||
|
|
|
@ -2,26 +2,21 @@
|
|||
|
||||
angular.module('forms').directive('keyToOption', function(){
|
||||
return {
|
||||
restrict: 'AE',
|
||||
transclude: true,
|
||||
restrict: 'A',
|
||||
scope: {
|
||||
field: '&'
|
||||
field: '='
|
||||
},
|
||||
link: function($scope, $element, $attrs, $select) {
|
||||
$element.bind('keydown keypress', function(event) {
|
||||
|
||||
var keyCode = event.which || event.keyCode;
|
||||
var index = parseInt(String.fromCharCode(keyCode))-1;
|
||||
console.log($scope.field);
|
||||
//console.log($scope.field);
|
||||
|
||||
if (index < $scope.field.fieldOptions.length) {
|
||||
event.preventDefault();
|
||||
$scope.$apply(function () {
|
||||
$scope.field.fieldValue = $scope.field.fieldOptions[index].option_value;
|
||||
if($attrs.type === 'dropdown'){
|
||||
$select.selected.option_value = $scope.field.fieldOptions[index].option_value;
|
||||
}
|
||||
console.log($scope);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
<div class="field row radio"
|
||||
on-enter-key="nextField()"
|
||||
key-to-option field="field"
|
||||
ng-if="field.fieldOptions.length > 0">
|
||||
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
|
||||
<h3>
|
||||
|
|
Loading…
Reference in a new issue