0

我无法从甜蜜的警报中从收音机中获取价值。我想将收音机中的价值赋予我的 HTML 页面。

addTags 是一个按钮,radioV 来自<p id="radioV"></p>html。

有任何想法吗?

$scope.addToTags = function() {
  var inputOptions = new Promise(function(resolve) {
    setTimeout(function() {
      resolve({
        'n': 'nouns',
        'a': 'adjectives',
        'v': 'verbs',
        'o': 'others',
        'i': 'idioms',
        'a': 'all'
      })
    }, 1000)
  })
  swal({
      title: 'Select only one:',
      input: 'radio',
      inputOptions: inputOptions,
      inputValidator: function(result) {
        return new Promise(function(resolve, reject) {
          if (result) {
            resolve()
          } else {
            reject('You need to select something!')
          }
        })
      }
    })
    .then(function(result) {
      swal({
        type: 'success',
        html: 'You selected: ' + result
      })
    })
    .then(function(result) {
      $('#radioV').attr(result).val();
    })
};

4

0 回答 0