0
votes

Making a doctor's website with Angular ui-router which switches partials through ui-sref. I need the ui-sref link to reload on the pages with the javascript widgets so they upload. Here is the view:

<a ui-sref="home">

and the state router in the js file:

  .state('home', {
      url: '/home',
      templateUrl: 'Partials/partial-home.html'
     })

I tried:

ui-sref-opts="{reload: true}"

in my ui-sref but it did not reload the widget. I tried other code I found here and that didn't help either. Here is the source code for anyone who wants to see: https://github.com/EBM26

1
You say "it doesn't work". What does that mean? What widget are you using? Is it an Angular module or jQuery / some other javascript? - Brian
If Im not mistaken, Brian, it is calling the API from the Health Tap website and its not refreshing when I click back to the home ui-sref <script type="text/javascript" src="https://www.healthtap.com/widget/askdoc.js" ></script> <div id="htapWidgetAskdoc" data-doctor="26158967" data-just_answers="true" data-color="rgb(246, 252, 208)" class="col-xs-4"><span>Powered by</span> <a href="https://www.healthtap.com">HealthTap</a> <div id="HtInboundLinks"> With content from: <a href="https://www.healthtap.com/experts/26158967">Dr. Danny Benmoshe's Virtual Practice</a><br></div> </div> - EBM26
Open the website in Chrome, on your keyboard do (CMD | CTRL) + OPTION + i > Go to the "Network" tab in your debugger panel > Look to see if there is an http transaction (either API call or script download) that matches what you want to be making - Brian
I don't think the question is clear enough, why do you want to reload the content when you go back? Are the widgets part of angular or is it another library? - Rick

1 Answers

0
votes

If you want to force the reload on the view, I would just do it on the controller. This breaks the whole point of a SPA.

See this question. "ui-sref" does not refresh the "ui-view"(its controller does not rerun) when a link is clicked twice