Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9271283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:34:59+00:00 2026-06-18T15:34:59+00:00

I am attempting to use the bootstrap scollspy to highlight list items generated by

  • 0

I am attempting to use the bootstrap scollspy to highlight list items generated by an angular repeater.

The problem I’m running into is that I’m refreshing the scrollspy plugin from an angular controller, before angular has applied the model changes to the view.

What is the angular way to ensure the scrollspy(‘refresh’) call happens after the DOM itself has been updated (not just the angular model)?

Template:

<div class="span2" id="addressList">
    <ul class="nav nav-tabs nav-stacked affix">
       <li ng-repeat="addr in addresses"><a href="#{{addr.id}}">{{addr.id}}</a></li>
    </ul>
</div>

Controller:

$scope.httpSuccessCallback = function (data) 
     $scope.addresses.push(data);
     $('[data-spy="scroll"]').scrollspy('refresh'); //calls $('#addressList .nav > li > a')
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:35:01+00:00Added an answer on June 18, 2026 at 3:35 pm

    How I solved this, using Blesh’s answer

    Template:

      <body ng-app="address" ng-controller="AddressCtrl" scroll-spy="addresses">
        <div class="container">
          <form ng-submit="lookupAddress()">
            <input type="text" ng-model="addressText" />
            <button id="addressQueryBtn">Submit</button>
          </form>
    
          <div id="addressList">
            <ul>
              <li ng-repeat="addr in addresses">{{addr}}</li>
           </ul>
          </div>
    
        </div>
      </body>
    

    Angular JS:

    angular.module('address', []).
    directive('scrollSpy', function($timeout){
      return function(scope, elem, attr) {
        scope.$watch(attr.scrollSpy, function(value) {
          $timeout(function() { elem.scrollspy('refresh') }, 200);
        }, true);
      }
    });
    
    function AddressCtrl($scope, $http) {
      $scope.addresses = [];
    
      $scope.lookupAddress = function() {
        $scope.addresses.push($scope.addressText);
        $scope.addressText = '';
      };
    }
    

    The third argument to scope.watch(…) is needed when the watched scope var is an object or array. Unfortunately, this solution still results in the unrecognized expression problem randomguy mentions in the comments. I ultimately resolved this by using a timeout in the watch function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Attempting to use XStream's JavaBeanConverter and running into an issue. Most likely I'm missng
I am attempting to use Inno Setup to bootstrap a WiX generated .msi file
In attempting to use std::select1st from <functional> in a VS2008 project I found that
I'm attempting to use an ajax source with Datatables, and I've run into some
I'm attempting to use TPH mapping for the following classes. Ignore that there's only
I am attempting to use the Bootstrap typeahead - but have no luck getting
In attempting to upgrade to Bootstrap 2 (using twitter-bootstrap-rails gem), it seems that page-specific
Attempting to use asp.net mvc's Action Result of File. So it would seem that
I am attempting to use Twitter Bootstrap input-append search and it's not lining up
I'm attempting to use groovyPageRenderer.render() to render a temple with a model, so that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.