sorry for my english. how to add js code in ionic 3 for use in particular page. im create countdown timer like this but ts (typescript) not accept js code. Thanks. like thisenter image description here
-
TypeScript is a superset of Javascript, it does accept Javascript code. Can you show us code you're trying to add?Zooly– Zooly2018-06-22 13:24:20 +00:00Commented Jun 22, 2018 at 13:24
-
thanks zooty: i'm using that js code : codepen.io/arcarr/pen/vGVGXNSkull dev– Skull dev2018-06-22 13:47:35 +00:00Commented Jun 22, 2018 at 13:47
Add a comment
|
1 Answer
Adding a custom JS in ionic is usually not needed.
But if you want to use use it anyway, You can refer to the StackOverflow Answer on using the custom JS to the ionic project.
5 Comments
Skull dev
im attempting these step nothing happens just pop window generate and say hello from external js.
Skull dev
var testvar = "Hello from external js" in js file
Skull dev
add js reference in index.html <script src="assets/js/test.js"></script>
Skull dev
declare var testvar; in component.ts
Skull dev
alert(testvar); in component.ts under the constructor {}