Ich versuche, AdMob zu einer App zu implementieren. Ich habe cordova-plugin-admob
installiert und versuche, $cordovaAdMob
in den Controller zu laden, wie in der offiziellen Dokumentation Cordova AdMob angegeben, aber ich bekomme unbekannten Provider Fehler. Ich dachte mir, dass es vielleicht nicht im Browser funktioniert, aber das gleiche passiert, wenn ich es auf dem Handy benutze.Cordova Ionic AdMob
Bei Bedarf ist hier Controller-Code, aber es ist AdMob leer, da ich nicht einmal dieses erste Problem bestanden habe.
.controller('newsCtrl', ['$state', 'Injection', '$scope', '$http', 'SERVER', 'thumbSERVER', '$cordovaAdMob',
function ($state, Injection, $scope, $http, SERVER, thumbSERVER, $cordovaAdMob) {
Injection.ResourceFactory.getResource($http, SERVER, 'news')
.then(function (response) {
$scope.news = response.data.news;
}, function (error) {
});
$scope.thumbnailPath = thumbSERVER;
}])
EDIT:
cordova.js
wird automatisch hinzugefügt, wenn neue Plattform zu schaffen (I Android installiert haben), und es wird in index.html
standardmäßig verwiesen. Wenn ich es injizieren, erhalte ich Fehler
Error: [$injector:nomod] Module 'ngCordova' is not available!
Haben Sie ng-cordova zu Ihrem Projekt hinzugefügt? '' in index.html und 'angular.module ('myApp', ['ngCordova'])' in app.js – e666
Es gibt eine tolles Tutorial hier: https://github.com/appfeel/admob-google-cordova/wiki/Angular.js,-Ionic-apps – David
Meistens funktionieren Plugins nicht in Browsern. Es ist besser, Plugins im Gerät zu überprüfen. –