angular-timer icon indicating copy to clipboard operation
angular-timer copied to clipboard

Install on Ionic App

Open brunomonteiro3 opened this issue 10 years ago • 13 comments
trafficstars

Hello,

I have tried several ways to install angular-timer on a Ionic app, but with no success. Any idea on how to do it or if it's even possible?

Many thanks.

brunomonteiro3 avatar Oct 01 '15 20:10 brunomonteiro3

That's on my list to test. Can you create a plunkr or something so I can take a look at it?

siddii avatar Oct 01 '15 20:10 siddii

No, I don't have any preview published. Sorry about that.

But for testing, I have just started a blank Ionic project, installed all the dependencies required by angular-timer, but when I try to start the timer, it doesn't even appear on the page.

brunomonteiro3 avatar Oct 01 '15 20:10 brunomonteiro3

any console error?

siddii avatar Oct 01 '15 20:10 siddii

I got this error, but I'm not sure if this is related.

http://i.imgur.com/qwPrBK8.png

brunomonteiro3 avatar Oct 01 '15 20:10 brunomonteiro3

Do you have this dependencies installed - https://github.com/siddii/angular-timer#requirements ?

siddii avatar Oct 01 '15 20:10 siddii

Yes! I have installed them via Bower and as you can see my code is requesting these files correctly: http://i.imgur.com/nVDaPIL.png

brunomonteiro3 avatar Oct 01 '15 20:10 brunomonteiro3

All I can say is that its something related to how angular-timer pulls in momentjs & humanize-duration dependencies. I have been thinking of breaking that dependency (making it optional) for a while.

I'll take a look at it when I get a chance.

siddii avatar Oct 01 '15 20:10 siddii

All right. Thanks for your help!

brunomonteiro3 avatar Oct 01 '15 20:10 brunomonteiro3

The current code on master should be able to support Ionic. Please checkout #219

siddii avatar Oct 03 '15 12:10 siddii

I was able to get it working just fine by running bower install angular-timer --save

(Make sure you have the save flag so it will update your bower.json file.)

Also, the order you are referencing the files could cause an error. I have this at the end of my bower script reference in index.html

    <script src="bower_components/momentjs/moment.js"></script>
    <script src="bower_components/humanize-duration/humanize-duration.js"></script>
    <script src="bower_components/angular-timer/dist/angular-timer.js"></script>

so these are loaded after angular and ionic.

Also, are you adding 'timer' to your app dependencies?

DaDanny avatar Oct 30 '15 22:10 DaDanny

DaDanny solution works for me. :)

SvOzMaS avatar Jul 01 '16 09:07 SvOzMaS

@DaDanny's solution also worked for me, but bower added my files to these paths:

<script src="lib/moment/moment.js"></script>
<script src="lib/humanize-duration/humanize-duration.js"></script>
<script src="lib/angular-timer/dist/angular-timer.js"></script>

zvineyard avatar Aug 16 '16 04:08 zvineyard

@zvineyard That should be fine. Ionic uses the lib directory out of the box, so if you built your app using ionic start, that is the expected behavior. I just preferred to keep it in my bower_components directory.

Glad I could help though. Let me know if you have any more trouble.

DaDanny avatar Aug 18 '16 20:08 DaDanny