Comments (10)
hi all i fixed the first issue by edit the app.ts code as below
var resources = application.getResources();
resources['fonticon'] = fonticon;
resources['isActive'] = isActive;
application.setResources(resources);
as @AdamDenoon mentioned
from nativescript-fonticon.
@uzarsalan That variable is unrelated to the issue and fonticon in general.
from nativescript-fonticon.
Solved. It was missing import application = require('application');
from nativescript-fonticon.
Same here:
tns --version
3.0.3
iOS Error:
JS ERROR TypeError: undefined is not an object (evaluating 'application.resources['fonticon'] = fonticon')
Android Error:
TypeError: Cannot set property 'fonticon' of undefined
File: "file:///<app.js>, line: 14, column: 34
Offending line: application.resources['fonticon'] = fonticon;
Offending part of line: application.resources['fonticon']<
Application.resources no longer has 'fonticon' as a property.
EDIT: I just upgraded to NativeScript 3.0.3, and that's when it stopped working.
from nativescript-fonticon.
Output of console.dir(application)
yields:
=== dump(): dumping function and properties names ===
JS: Observable()
JS: hasLaunched()
JS: getResources()
JS: setResources()
JS: on()
JS: off()
JS: notify()
JS: hasListeners()
JS: setApplication()
JS: livesync()
JS: setCssFileName()
JS: getCssFileName()
JS: addCss()
JS: AndroidApplication()
JS: start()
JS: getMainEntry()
JS: getNativeApplication()
JS: getOrientation()
JS: === dump(): finished ===
This tells me that the new way to set the resources for the application is to use the setResources()
method.
To fix this issue, replace application.resources['fonticon'] = fonticon;
with application.setResources(fonticon);
from nativescript-fonticon.
How do i access that fonticon?
<Label text="{{ sp_icon | fonticon }}" class="ion" style="font-size:30;" />
JS: Cannot find function or filter: fonticon
from nativescript-fonticon.
I had the same problem. I just ensured I had "fa" listed as a class on my XML element, then loaded the icon via JS:
<Button id="next-button" class="fa" text="" onTap="callAction" />
var fonticon = application.getResources(fonticon);
. . .
var nextButton = page.getViewById("next-button");
nextButton.text = fonticon('fa-chevron-right');
from nativescript-fonticon.
i am having the same problem even after creating a new project it isnt working on ns 3.0.3 tsc or js but on angular is working fine
from nativescript-fonticon.
What variable isActive?
from nativescript-fonticon.
I have the same issue and I get no errors after using @moayadnajd ยดs answer but my icons are not displayed:
app.ts:
import * as application from 'application';
import {TNSFontIcon, fonticon} from 'nativescript-fonticon';
//TNSFontIcon.debug = true;
TNSFontIcon.paths = {
'fa': 'font-awesome.css',
'ion': 'ionicons.css'
};
TNSFontIcon.loadCss();
var resources = application.getResources();
resources['fonticon'] = fonticon;
application.setResources(resources);
application.start({ moduleName: 'main-page' });
app.css:
.fa {
font-family: FontAwesome, fontawesome-webfont;
font-size:60;
}
.ion {
font-family: Ionicons, ionicons;
font-size:60;
}
main-page.xml:
<GridLayout rows="auto auto" columns="50 *">
<Label class="fa" text="{{'fa-user' | fonticon}}" row="0" col="0" horizontalAlignment="center" verticalAlignment="center"/>
<TextField hint="Email" keyboardType="email" autocorrect="false" autocapitalizationType="none" row="0" col="1"/>
<Label class="fa" text="{{'fa-lock' | fonticon}}" row="1" col="0" horizontalAlignment="center" verticalAlignment="center"/>
<TextField hint="Pass" secure="true" row="1" col="1"/>
</GridLayout>
from nativescript-fonticon.
Related Issues (20)
- Updating the ion-icons library to version 2 HOT 2
- Javascript Implementation Issues
- [Nativescript-Vue] Font Awesome 5, it show [Question Mark] HOT 15
- [Nativescript-Vue] nativescript-fonticon v2 - update guide HOT 14
- material-design-icons css parsing issue HOT 1
- Is there a Javascript version of this? HOT 5
- Doesn't work with single quotes on CSS
- [IOS] : Font Awesome 5 PRO - Light icon always displayed as solid HOT 2
- why (fa-spin it's not working HOT 1
- Some icons work, some icons do not...
- how to integrate with scss HOT 1
- [Nativescript-Vue] CSS file being loaded after home page is mounted HOT 1
- [Nativescript-Vue] CSS file being loaded after home page is mounted HOT 7
- Icon with text HOT 7
- not working with materialdesignicons
- Using with angular 4 HOT 1
- Problem with Icomoon iconfonts HOT 1
- Webpack bug HOT 3
- Use with TabView HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nativescript-fonticon.