initialxy / cordova-plugin-themeablebrowser

Fork of org.apache.cordova.inappbrowser in an attempt to make it a bit more themeable and configurable to add some custom actions.
Apache License 2.0
294 stars 221 forks source link

ionic Themeable Browser throws error `Unknown provider: themeablebrowserProvider <- themeablebrowser` #134

Open sathishchinniah opened 7 years ago

sathishchinniah commented 7 years ago

I am try to open pdf in Themeable Browser.. Here my code that i am using 👍

i did ; sudo cordova plugin add cordova-plugin-themeablebrowser

`.controller('LoginCtrl',function($scope, $state, $ionicPopup, $window, themeablebrowser) { $scope.openpdf = function() {

console.log("open pdf button tap");

cordova.ThemeableBrowser.open(' http://www.pdf995.com/samples/pdf.pdf', '_blank', { statusbar: { color: '#ffffffff' }, toolbar: { height: 44, color: '#f0f0f0ff' }, title: { color: '#003264ff', showPageTitle: true }, backButton: { image: 'back', imagePressed: 'back_pressed', align: 'left', event: 'backPressed' }, forwardButton: { image: 'forward', imagePressed: 'forward_pressed', align: 'left', event: 'forwardPressed' }, closeButton: { image: 'close', imagePressed: 'close_pressed', align: 'left', event: 'closePressed' }, customButtons: [ { image: 'share', imagePressed: 'share_pressed', align: 'right', event: 'sharePressed' } ], menu: { image: 'menu', imagePressed: 'menu_pressed', title: 'Test', cancel: 'Cancel', align: 'right', items: [ { event: 'helloPressed', label: 'Hello World!' }, { event: 'testPressed', label: 'Test!' } ] }, backButtonCanClose: true }).addEventListener('backPressed', function(e) { alert('back pressed'); }).addEventListener('helloPressed', function(e) { alert('hello pressed'); }).addEventListener('sharePressed', function(e) { alert(e.url); }).addEventListener(cordova.ThemeableBrowser.EVT_ERR, function(e) { console.error(e.message); }).addEventListener(cordova.ThemeableBrowser.EVT_WRN, function(e) { console.log(e.message); });

  }   

})`

My html ; button class="button button-icon" ng-click="openpdf()">Open PDF</button>

Don't know why this issues is showing. Any help !!

VitorHFLopes commented 6 years ago

@sathishchinniah I think you are injecting something that is not injectable, in case "themeablebrowser".

I use just cordova.ThemeableBrowser.open( ... and it opens normally, without injecting anything.

I hope it helps :)

nekrodomus commented 6 years ago

In Ionic

Add

import { ThemeableBrowser } from '@ionic-native/themeable-browser';

in

app.module.ts

And

ThemeableBrowser

in provider section

@NgModule({ declarations: myDeclarations(), imports: [ BrowserModule, HttpModule, TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: HttpLoaderFactory, deps: [Http] } }), IonicModule.forRoot(Netro), IonicStorageModule.forRoot(), IonicImageViewerModule, ], bootstrap: [IonicApp], entryComponents: myDeclarations(), providers: [ .... ThemeableBrowser, <--------HERE!!! .... ] }) export class AppModule { }