javascript - How does angularjs query the second-level menu based on the first-level menu?
伊谢尔伦
伊谢尔伦 2017-07-07 10:34:54
0
4
1539

Query the secondary industry through the primary industry, and query the primary industry through the secondary industry. How to write it? The data transmitted in the background is like this

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all (4)
世界只因有你

When selecting the first level, the change time is triggered and the data bound to the second level is replaced.

    巴扎黑

    When selecting the first level, send a request to the background to obtain the second level data, and then bind the corresponding data to the second level

      学霸

      My first feeling is that there is something wrong with the data returned by the background.
      Your secondary menu type field currently seems to be a string, but logically it should be an array, because otherwise, you can directly bind the type_directory field in the corresponding obj to the display box of the primary menu. , and the display box of the secondary menu is just bound to the type field.
      But obviously it shouldn’t be like this.
      Thinking:
      According to your interface data, it should be that when the page is loaded, you have already requested the interface to obtain data (or request data again when clicking the first-level menu box, as long as you give it to the user (Confidence in the experience), at this time, bind all type_directory fields to the drop-down box of the display box of the first-level menu, and then when clicking to select the first-level menu, request data again and obtain the selected first-level menu. The drop-down box where the menu is locatedsubscript, get the type field based on the subscript, and then bind it to the drop-down box of the secondary menu display box
      It's a bit messy to say it directly, I hope you can understand, in fact, it feels the best, The backend of the first-level menu can give you an ID, and to get the second-level menu, you can directly request the interface to pass the ID, and just pull all the second-level menus under the ID directly

        洪涛

        The data must be in cascade form. The first-level menu selects an item, and the sub-level array under the item is assigned to the second-level menu. And so on

          Latest Downloads
          More>
          Web Effects
          Website Source Code
          Website Materials
          Front End Template
          About us Disclaimer Sitemap
          php.cn:Public welfare online PHP training,Help PHP learners grow quickly!