Closed tonyshare closed 3 years ago
@tonyshare - did you find a solution for this? I'm getting the same error but with 'Page'. Any ideas? thanks much in advance!
JS: ERROR NullInjectorError: R3InjectorError(AppModule)[Page -> Page -> Page]: JS: NullInjectorError: No provider for Page! JS: bootstrap: Error bootstrapping app module: JS: R3InjectorError(AppModule)[Page -> Page -> Page]: JS: NullInjectorError: No provider for Page! JS: JS: NullInjectorError: R3InjectorError(AppModule)[Page -> Page -> Page]: JS: NullInjectorError: No provider for Page! JS: at NullInjector.get (file: src\webpack:\@nativescript\mayapp\node_modules\@angular\core\__ivy_ngcc__\fesm2015\core.js:11081:0) JS: at R3Injector.get (file: src\webpack:\@nativescript\mayapp\node_modules\@angular\core\__ivy_ngcc__\fesm2015\core.js:11247:0) JS: at R3Injector.get (file: src\webpack:\@nativescript\mayapp\node_modules\@angular\core\__ivy_ngcc__\fesm2015\core.js:11247:0) JS: at R3Injector.get (file: src\webpack:\@nativescript\mayapp\node_modules\@angular\core\__ivy_ngcc__\fesm2015\core.js:11247:0) JS: at NgModuleRef$1.get (file: src\webpack:\@nativescript\mayapp\node_modules\@angular\core\__ivy_ngcc__\fesm2015\core.js:25341:0) JS: at Object.get (file: src\webpack:\@nativescript\mayapp\node_modules\@angular\core\__ivy_ngcc__\fesm2015\core.js:25055:0) JS: at lookupTokenUsingModuleInjector (file: src\webpack:\@nativescript\mayapp\node_modules\@angular\core\__ivy_ngcc__\fesm2015\core.js:3342:0)
I forgot how I solved the problem, this is my code you can reference:
component.ts
import { Lightbox } from 'ngx-lightbox';
export class Detail{
constructor(
public _lightbox: Lightbox
) { }
open(link: string, caption: string) {
this._album = [];
this._album.push({
src: link,
caption: caption,
thumb: link,
});
this._lightbox.open(this._album, 0);
}
html
<td class="bg-success" (click)="open('/link/to/img', 'campus')"></td>
i had same problem, importing LightboxModule in AppModule solved the issue
Enviroment
angular: 10 or 11
I created a test example of using ngx-lightbox. In the component:
the project can pass the complie processing.
When I opened the page and got the following error messages: