2015-01-25 2 views
0

저는 다양한 방법으로 deviceAttributes라는 객체를 내보내는 Cordova 플러그인 i에서 AngularJS를 사용하고 있습니다. 해당 객체의 메서드에 액세스 할 수 있도록 내 JS 코드에서 특별한 작업을 수행해야합니까? 내가 콘솔에서 받고 있어요 것은 :angularJS 앱 내 cordova (phonegap) 플러그인 사용

hardwareTypeErr 잘못된 행동 AttributesController.js : 12 작동하지 AttributesController.js : 13

가 작용에 의해 방법을 찾을 수없는 것처럼 그렇게 보인다 몇 가지 이유.
로그인 컨트롤러 코드 :

LoginApp.controller ('AttributesController', [ '$ 범위', 기능 ($ 범위) {

이 여기 AngularJS와

없이 간단한 HTML5 응용 프로그램에서 작동하는 것은 내 코드입니다

$scope.testAttributesController = function(){ 
    function hardwareTypeSucc(data) 
    { 
     console.log("hardwareTypeSucc " + data); 
    } 
    function hardwareTypeErr(data) 
    { 
     console.log("hardwareTypeErr " + data.toString()); 
     console.log("not working"); 
    } 
     var x =deviceAttributes.getHardwareType(hardwareTypeSucc,hardwareTypeErr); 
}; 


}]); 

코르도바 플러그인 plug.js 파일을 해결

var deviceAttributes = { 
getHardwareType: function(success, failure){ 
    cordova.log("getHardwareType"); 
    cordova.exec(success, failure, "Device", "getHardwareType", []); 
}, 
getOSType: function(success, failure){ 
    cordova.exec(success, failure, "Device", "getOSType", []); 
} 

}; 

module.exports = deviceAttributes; 
+0

AngularJS를 사용하는 Ionic을 사용합니다. http://ionicframework.com/ –

답변

0

는 는 PL 프로젝트가 이미 있었다 것 같은 이름을 지닌 ugin.

관련 문제