Я получаю ошибку ниже, это мое приложение AngularJs.undefined не является функцией ошибки в AngularJS
TypeError: undefined is not a function
at Scope.$rootScope.shareImageNow (index.controller.js:150)
Я не уверен, в чем причина после некоторых исследований Google.
controller.js Файл
app.controller('ViewCtrl', function($rootScope, $state, $scope, $ionicPlatform, $ionicPopup, $ionicLoading, $ionicSlideBoxDelegate, $ionicScrollDelegate, $timeout, Service) {
var appUrl = "https://play.google.com";
$rootScope.shareNow = function() {
var message = "xx";
var subject = "yy";
Service.share(message, subject, null, appUrl);
}
$rootScope.shareImageNow = function() {
var imageIndex = 0;
var imgUrl = $rootScope.itemData[imageIndex]['url'];
var message = "xx";
var subject = "yy";
Service.share(message, subject, imgUrl, appUrl);
}
});
service.js Файл:
module.service('Service', function($rootScope, $ionicPlatform, $cordovaSocialSharing) {
$rootScope.share = function(message,subject,file,link) {
$ionicPlatform.ready(function() {
$cordovaSocialSharing
.share(message, subject,file,link);
}, false);
}
}
Ошибка отображается в строке ниже в controller.js файле.
Service.share(message, subject, null, appUrl);
Какой является линия 150 в index.controller.js –
К сожалению @DavidGrinberg. Я сейчас обновил этот вопрос. Отображаемая ошибка находится в Service.share (сообщение, тема, null, appUrl); – Purus