The sref in ui-router does not support dynamic binding.

Source: Internet
Author: User
Angular-Ui is a very important tool for angular developers, where ui-router is a top priority. However, we found that the sref does not support dynamic binding. Specifically: & lt; aui-sref & quot; homePage & quot; & gt; Home & lt; a & gt; this is a very simple ui-sref Angular-Ui is a very important tool for angular developers, where ui-router is a top priority. However, we found that the sref does not support dynamic binding. Specifically, Home is a very simple ui-sref. When javascript re-generates a webpage, it searches for the state named "homePage" in $ state, read the url of the state and generate href = "url" in tag ". However, if you are creating a navigation controller, there is an array of navigation items: $ scope. items = [{name: "Home", statePage: "homePage"}, {name: "About Me", statePage: "aboutMePage"}] And then use repeat in html:
  • <{Item. name }}
  • The fact is that sref does not support dynamic binding and such code reports an error. In sref, you can only use the state name and add at most some parameters. Someone has submitted this question on github. In this case, you can only discard the sref and bind it with the href. You can use $ state. href to read the state url.

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.