2015-02-09 226 views
0

我想導入示例插件在科爾多瓦/離子測試,我現在試試這個如何使用插件在科爾多瓦/離子框架

$ cordova plugin add org.apache.cordova.device 

在我的index.html我用這個代碼

var model = device.model; 
document.write(device.model); 

然後

cd myionicApp 
cordova emulate 

,但它不工作,誰能幫助我? 還安裝科爾多瓦CLI和科爾多瓦Plugman和離子框架

回答

1

document.addEventListener("deviceready", success, error); 
function success(){ 
    var model = device.model; 
    document.write(device.model); 
}; 
function error(){ 

}; 

添加

var model = device.model; 
document.write(device.model); 

在你的情況下,它並沒有因爲工作在設備準備就緒之前不會調用插件。所以我們需要添加設備準備好的監聽器。那麼只有任何插件會被調用。

問候。

相關問題