Dart2js& #39;的输出导致“null不是对象”
dart2js's output causes "null is not an object"
运行后
private/dart/dart-sdk/bin/dart2js -m -o public/js/script.js private/dart/script.dart
结果javascript返回
TypeError: 'null' is not an object (evaluating 'J.RE(a).gVs')
然而,未被最小化的错误是
TypeError: 'null' is not an object (evaluating 'J.getInterceptor$x(receiver).get$onBlur')
这可能更有意义。
无论我使用script.js还是script.compiled.js,它都会这样做。
省道代码是
import 'dart:html';
import 'dart:core';
void main() {
querySelector("#authorInput").onBlur.listen(updateSurname);
}
void updateSurname(Event e){
String author = (e.target as InputElement).value;
String surname = author.split(' ').last;
querySelector("#surnameInput").text = surname;
}
.form-group
%label(for="authorInput") Author
%input.form-control#authorInput(type="text" name="author" placeholder="Enter author")
.form-group
%label(for="surnameInput") Surname
%input.form-control#surnameInput(type="text" name="surname" placeholder="Enter surname")
我相信它应该这样工作,尽管情况显然不是这样。
我明白了
我将编译好的javascript文件包含在html页面的标签中。把它移到身体的最底部,就能解决一切问题。
相关文章:
- 谷歌地图API-“;toGeoJson”;返回几何体为null的对象
- 验证对象是否为null Javascript/Angularjs
- 对象为null或IE9中存在未定义错误
- 如何计算一个对象中五个属性中有多少是非null的
- Microsoft JScript运行时错误:无法获取属性'的值;样式':对象为null或未定义
- javascript对象显示为null,但object.properties返回数据
- global.getElementById('..')为null或不是对象
- IE8错误:为null或不是对象,但仍然可以跟踪/控制台注销
- AJAX请求中的JSON对象为Null或空
- Highcharts无法设置属性'的值;要点':对象为null或未定义
- ui.selectmenu投掷'this.newelement.0'为null或不是对象
- 添加到序列化数组中的复杂对象在服务器端始终为 null
- 什么是 ClojureScript 类似地将不存在的对象值设置为 JavaScript 中的 null
- 最大查询返回带有sequelise.js的null对象
- 从JSON对象中删除jQuery和null对象
- 从客户端到服务器的SocketIO回调没有'不起作用(改为null对象)
- 迭代react元素中的undefined/null对象
- “Interiting"From null对象似乎不会影响性能
- Null对象中属性默认值的赋值
- 在js中捕获null对象