Closed JoeyHengst closed 7 years ago
Another issue appeared though.
[ERROR ->][text]="('fa-google' | fonticon)
The pipe 'fonticon' could not be found
app.component.ts import { TNSFontIconService } from 'nativescript-ng2-fonticon'; constructor(private fonticon: TNSFontIconService) {}
login.component.html <Button [text]="('fa-facebook' | fonticon) +
Also tried to add it to the login.component.ts but still getting the error that fonticon is not recognized.
package.json
"tns-ios": {
"version": "2.4.0"
},
"tns-android": {
"version": "2.4.1"
}
},
"dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/router": "3.2.1",
"email-validator": "1.0.4",
"nativescript-angular": "1.2.0",
"nativescript-ng2-fonticon": "1.3.4",
"nativescript-permissions": "^1.2.1",
"nativescript-plugin-firebase": "^3.8.4",
"nativescript-social-share": "^1.3.1",
"nativescript-telerik-ui": "^1.5.1",
"nativescript-theme-core": "^0.2.1",
"reflect-metadata": "~0.1.8",
"rxjs": "5.0.0-beta.12",
"tns-core-modules": "2.4.4"
},
"devDependencies": {
"babel-traverse": "6.21.0",
"babel-types": "6.21.0",
"babylon": "6.14.1",
"lazy": "1.0.11",
"nativescript-dev-android-snapshot": "^0..",
"nativescript-dev-sass": "^0.4.1",
"nativescript-dev-typescript": "^0.3.2",
"typescript": "~2.0.10",
"zone.js": "~0.6.21"
}
hi, I faced this problem, and it seems to work better if you avoid the 'cross-module' problem listed here http://stackoverflow.com/questions/39007130/the-pipe-could-not-be-found-angular2-custom-pipe#39007605 - so put your
TNSFontIconModule.forRoot({
'fa': 'fonts/font-awesome.css'
}),
code in the module where you'll use it, not the app.module.ts
file. I don't know if this is proper but it seems to work. I don't really love this pattern - Nathan, is it right? Shouldn't we declare these pipes globally?
@jlooper I have tried this too. And this is still not working. it still says the pipe fonticon could not be found. Has anyone resolved this. I am using NathanWalker's angular-seed-advanced
@NathanWalker i am facing the same issue here is my code import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core"; import { NativeScriptModule } from "nativescript-angular/nativescript.module"; import { NativeScriptUISideDrawerModule } from "nativescript-ui-sidedrawer/angular";
import { AppRoutingModule } from "./app-routing.module"; import { AppComponent } from "./app.component";
import { TNSFontIconModule, TNSFontIconService } from 'nativescript-ngx-fonticon'; // turn debug on TNSFontIconService.debug = true;
@NgModule({ bootstrap: [ AppComponent ], imports: [ AppRoutingModule, NativeScriptModule, NativeScriptUISideDrawerModule, TNSFontIconModule.forRoot({ 'fa': './assets/font-awesome.css' }) ], declarations: [ AppComponent ], schemas: [ NO_ERRORS_SCHEMA ] })
export class AppModule {
}
file:///app/app.module.ts:11:54: JS ERROR Error: Could not find module 'nativescript-ng2-fonticon'
app.module.ts
import { TNSFontIconModule, TNSFontIconService } from 'nativescript-ng2-fonticon';
imports: [ NativeScriptModule, TNSFontIconModule.forRoot({ 'fa': 'font-awesome.css', 'ion': 'ionicons.css' }),
package.json ` "tns-ios": { "version": "2.4.0" }, "tns-android": { "version": "2.4.1" }
"dependencies": { "@angular/common": "2.2.1", "@angular/compiler": "2.2.1", "@angular/core": "2.2.1", "@angular/forms": "2.2.1", "@angular/http": "2.2.1", "@angular/platform-browser": "2.2.1", "@angular/platform-browser-dynamic": "2.2.1", "@angular/router": "3.2.1", "email-validator": "1.0.4", "nativescript-angular": "1.2.0",
"nativescript-ng2-fonticon": "file:..", "nativescript-permissions": "^1.2.1", "nativescript-plugin-firebase": "^3.8.4", "nativescript-social-share": "^1.3.1", "nativescript-telerik-ui": "^1.5.1", "nativescript-theme-core": "^0.2.1", "reflect-metadata": "~0.1.8", "rxjs": "5.0.0-beta.12", "tns-core-modules": "2.4.4" }, "devDependencies": { "babel-traverse": "6.21.0", "babel-types": "6.21.0", "babylon": "6.14.1", "lazy": "1.0.11", "nativescript-dev-android-snapshot": "^0..", "nativescript-dev-sass": "^0.4.1", "nativescript-dev-typescript": "^0.3.2", "typescript": "~2.0.10", "zone.js": "~0.6.21" }`
Running on iOS simulator after full reset.
**edit changing it to version 1.3.4 fixed it. |-_-|