TypeError:无法读取null的属性“slice”

时间:2015-06-16 02:57:52

标签: meteor meteor-autoform meteoric

我在项目中使用autoform并在打开表单时收到此错误 不确定这是因为任何版本或依赖,我的autoform不工作,我收到此错误,我有截图和架构代码,下面的表单代码,

enter image description here

模板

 // Fetches the first tweet from a given user's timeline
private static String fetchTimelineTweet(String endPointUrl)
        throws IOException {
    HttpsURLConnection connection = null;



    try {
        URL url = new URL(endPointUrl);
        connection = (HttpsURLConnection) url.openConnection();
        connection.setDoOutput(true);
        connection.setDoInput(true);
        connection.setRequestMethod("GET");
        connection.setRequestProperty("Host", "api.twitter.com");
        connection.setRequestProperty("User-Agent", "anyApplication");
        connection.setRequestProperty("Authorization", "Bearer " +  endPointUrl);
        connection.setUseCaches(false);


        String res = readResponse(connection);
        Log.i("Response", res);
        return new String();
    } catch (MalformedURLException e) {
        throw new IOException("Invalid endpoint URL specified.", e);
    } finally {
        if (connection != null) {
            connection.disconnect();
        }
    }
}

集合

<template name="assesmentNew">
  {{#ionModal customTemplate=true}}
    {{# autoForm collection="Assesments" id="assesments-new-form" type="insert"}}
      <div class="bar bar-header bar-stable">
        <button data-dismiss="modal" type="button" class="button button-clear">Cancel</button>
        <h2 class="title">New Assesment</h2>
        <button type="submit" class="button button-positive button-clear">Save</button>
      </div>
      <div class="content has-header overflow-scroll">
        {{> afQuickField name="name" }}
        {{> afQuickField name="email"}}
        {{> afQuickField name="category"}}
        {{> afQuickField name="location"}}
      </div>
    {{/autoForm}}
  {{/ionModal}}
</template>

1 个答案:

答案 0 :(得分:1)

对于新版本的autoform,autoform-ionic的新补丁是个问题。

显然有些标签被跳过,有些则没有(见here)。为了解决这个问题并在输入类型不存在时避免此错误(例如,type = number),autoform呈现的所有模式字段都必须定义标签类型选项:

...
autoform: {
   'label-type': 'placeholder',
   placeholder: 'Linha'
}