search

Home  >  Q&A  >  body text

Front-end - How to coordinate development work between multiple controllers in angular

http://jsfiddle.net/p2227/fUzKX/3/

I feel like someone should have asked, but I couldn’t find it in the search.

As shown in the example, the data is very simple, and this is how the business is now.
1. First of all, one layer of view has been used, but now there are many layers of business in one layer of view, which we call sub-business ABCD
2. It turns out that ABCD was made by different people when we designed it, so it was an independent HTML and independent control
3. So I made another big control0, including each control, and used switch to switch. I found it easy to use, such as the sample code
4. The problem now is that each page turns out to be independent HTML. Oh, can you load the HTML by specifying the URL (specify an attr of p in ng-controller="ctrl1", or other methods)? This way you don’t have to mechanically copy and paste everyone’s original HTML
5. The project contains requirejs and should be available.

伊谢尔伦伊谢尔伦2775 days ago662

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-05-15 16:51:11

    1. There are two official ways to dynamically introduce html:
    <p ng-view></p>
    

    This method requires you to configure routing to switch
    Suitable for commonly used whole screen switching

    <p  ng-include src='xxxx'>
    

    xxx can be a dynamically changing address
    Just bind different controllers directly to different subpages.
    Applicable scenarios, switching between different pages in sub-pages.

    reply
    0
  • Cancelreply