Ionic - Adding js links in script tags


#1

Hi, how do I add the scripts below to my ionic 2 project?

[script src=“https://js.braintreegateway.com/web/3.6.3/js/client.min.js” script][/script]
[script src=“https://js.braintreegateway.com/web/3.6.3/js/hosted-fields.min.js”][/script]

pretend the brackets are greater than less than.


#2

Maybe this can help you.


Haven’t tried it myself, had problems with even getting typings to work then I started learning about Ionic. :sweat_smile:


#3

Im sorry no. I still have issues. The documentation on using script tags is unclear and every third party review on the matter never specifies implementation or a work around.

Its very tough.

If i cant use this with braintree I cant use this at all.


#4

I mean, I know that script tags go in the src/index.html but the hello-ionic.html page that uses the src file cant access it.


#5

same problem here. Have you solved it?


#6

You can put the script tags in the index.html that sits in www. place it after
build/main.js script tags

you can also take the code inside the script tags and place in a ts file.

the variables will have to be declared as -> variable: (type);

types include any, String, Number, etc. Use “any” if ur not sure which type it ought to be.

assign the variable a value -> variable = (value, function, class, etc.);

And each time u call the variable u use an instance -> this.variable;


#7

In regards to using braintree, you have to create the braintree backend (using the implementation of your choice) which you will then upload to a server.

You will then create an api call to access braintree from your client app.

But!

If you are just looking to include a simple JavaScript library (something like a google maps api for rendering maps) you can add the script tag to the index.html that sits in the \src directory of your project.