2016-11-15 21 views
1

我正在尝试使用Web Midi API构建一个Angular2项目。ng生成错误 - 属性'requestMIDIAc​​cess'不存在

当运行ng build,我无法完成过程中因抛出一些错误,特别是:

 
Error in bail mode: [default] /Users/JmsToh/GitHub/web-editor/web-editor/src/app/midi.service.ts:43:22 
Property 'requestMIDIAccess' does not exist on type 'Navigator'. 

这来自于这部分代码:

if (navigator.requestMIDIAccess) { 
    this.browserMidiCompatible = true; 
    navigator.requestMIDIAccess({ sysex: false }) 
    .then(this.onMIDISuccess.bind(this), this.onMIDIReject.bind(this)); 
} else { 
    alert("Platform not compatible"); 
} 

的应用程序运行在Chrome上运行得很好ng serve。有没有什么办法让Angular2在构建时忽略错误?

回答

3

好吧,我设法这样做,而不是删除此错误:

navigator["requestMIDIAccess"]

相关问题