question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: why I can't start the spinner?

See original GitHub issue

I’ve been using a different “way” of creating controllers, so is not exactly as your example. I can’t get the spinner to start:

var myApp = angular.module('myApp', ['ngRoute', 'ui.bootstrap', 'toaster', 'angularSpinner']);

angular.module('myApp').controller('productsController', function($scope, $modal, $http, toaster, usSpinnerService) {

    $scope.hey = "hey!";
    usSpinnerService.spin('loading-products');  // <-- not working, no errors thrown though.
    ...

});

My view is as follows:

  <h1>Products</h1>
  {{hey}}

  <span us-spinner="{radius:30, width:10, length: 16}" spinner-key="loading-products"></span>

“hey is correctly displayed” (just as a reference)

Am I bringing the usSpinnerService service in an incorrect manner? Thank you.

I though of asking this in stackoverflow but here you can also tag the issue as a question, right? sorry if not.

Issue Analytics

  • State:open
  • Created 9 years ago
  • Comments:16

github_iconTop GitHub Comments

3reactions
psaiacommented, Oct 19, 2014

Just had this issue as well. It’s because the $broadcast is firing before the $on is ready. While it isn’t ideal, try wrapping your spin method in a timeout:

$timeout(function() {
  usSpinnerService.spin('my-spinner');
}, 100);
2reactions
shahzadthathalcommented, Mar 20, 2016

Here is working solution! I just put us-spinner directive above ng-view

`

<div class="container">

<span us-spinner="{radius:30, width:8, length: 16}" spinner-key="spinner-1"></span>

<!-- All templates will load here -->

<div ng-view=""></div>

</div>

<!-- /.container -->

` and call in my controller

`

        var MainCtrl =   clientApp.controller('MainCtrl', ['$scope', '$http', 'usSpinnerService',

      function ($scope, $http, usSpinnerService) {

    usSpinnerService.spin('spinner-1');

    $scope.products = [];

   $http.get(AppConfig.SERVERURL + '/api/product/list')
    .then(function (result) {
       $scope.products =  result.data;

    });

    usSpinnerService.stop('spinner-1');

   }]);

`

Read more comments on GitHub >

github_iconTop Results From Across the Web

Having Trouble Getting You Wind Spinner To Spin? Try This
Start by holding the center point, then grabbing the outermost ring. Then, twist the outer ring until the decoration opens.
Read more >
How to fix a fidget spinner that won't spin - YouTube
My aluminum tri- spinner ( http://amzn.to/2pteqdO ) just wouldn't spin for more than a few seconds. There was clearly a rub that was...
Read more >
How Do You Fix a Fidget Spinner? - YouTube
Your fidget spinner might be rusty, wobbly, or simply just won't spin. Let's diagnose the problem and figure out how you can be...
Read more >
Why i cannot select first choice of the spinner? - Stack Overflow
onItemSelected function will be called only when the user selects a different item in spinner than the currently selected item. For example :....
Read more >
Wheel Decide
Can't decide? Wheel Decide for you! Set your own custom choices and then spin the wheel to make the random decision of lunch,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found