In this post, I’ll talk about the best way to use UIkit with angular 2 or 4 using angular-cli
I wrote this post just to use it later as I forgot too much.
Before we begin, English is not my first language, so if you see something weird, please, calmly point it out in the comment section or email me, there’s no need for violence :)
First I’ll assume that you already have an angular Project
or you can create a new one using angular-cli command
then move to the project folder
next we have to add dependency to jquery and uikit
Now we have to edit the file .angular-cli.json and add some jquery and UIKit scripts
scroll to the part of scripts then add the scripts of jquery, UIkit and UIkit icons
Now we can use UIKit wherever we want, next I’ll show simple way to use UIKit alert
First I prefer to use sass instead of css, So in the file .angular-cli.json
change the end of it to be like the next lines
I just changed styleExt from css to scss
and then you have to rename two files styles.css to styles.scss and in the app folder change app.components.css to app.components.scss
and in the file app.components.ts it should look like this
then to use the UIKit alert the same file will be like this
now we have to change the app.component.html file to add the alert, add the next code
next we have to add UIKIT styling so in the styles.scss file add the next line
That’s all you can find this post on my medium account too here
Some useful Links:
- 👨️ My Website/Portfolio
- 🔥 Get your $50 in FREE hosting credit HERE
- 🤑️ No Stripe? How To Get Paid With Payoneer ⇒ $25 + $10 Sign UP Bonus