search

Home  >  Q&A  >  body text

angular.js - What is the difference between ng-view and ng-include? What are the applicable situations for both?

New to angular~
What is the difference between ng-view and ng-include? What are the applicable situations for both?

某草草某草草2814 days ago651

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-05-15 16:55:23

    http://stackoverflow.com/questions/20025101/how-to-decide-when-to-use-...
    Simply put,
    Use ng-view. This method can easily implement page combination by using routing control. But this method also has a major disadvantage, that is, there can only be one ng-view in an html file. There are workarounds though. He can be controlled by ctl.
    ng-include extracts common pages from multiple pages, such as header.html, footer.html, etc., and introduces them with <dv ng-include="header.html"></p> on each page.

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-15 16:55:23

    I personally tested it, and regarding ng-include的说法不太对,用法应该是<p ng-include="'header.html'">, there should be a single quotation mark in the middle. Reference from: http://www.runoob.com/angular...

    reply
    0
  • Cancelreply