Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
245 views
in Technique[技术] by (71.8m points)

javascript - How to put reload option in ui-sref markup

How can I specify the reload option in a ui-sref markup? All the examples I see use the javascript function directly.

<a ui-sref="app.editPost({new:true}, {reload:true})">new post</a>

Doesn't seem to work. Do I have to create a scope controller function to wrap that reload option instead?

I've also tried some answers below and it doesn't seem to work with the Ionic framework. Link to code pen sample below:

http://codepen.io/anon/pen/LERqeb

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use ui-sref-opts. Here you go:

<a ui-sref="app.editPost({new:true})"
   ui-sref-opts="{reload: true, notify: true}">new post</a>

https://ui-router.github.io/ng1/docs/0.3.1/index.html#/api/ui.router.state.directive:ui-sref


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...