search

Home  >  Q&A  >  body text

angular.js - How to reference js in angularjs subpage

angularjs subpage how to quote js

我想大声告诉你我想大声告诉你2810 days ago693

reply all(6)I'll reply

  • 黄舟

    黄舟2017-05-15 17:14:03

    angular is a SPA (Single Page Application) page, a single-page application
    All JS is loaded on the first page
    I’m not sure what file your pull-top.js is, if it is a third-party plug-in for js , you can encapsulate it into a directive and call this directive on the sub-page

    reply
    0
  • 为情所困

    为情所困2017-05-15 17:14:03

    If you insist on doing this, you can look at lazyload.js, but for some small and medium-sized projects, this is not very meaningful, because angular is a single-page application, and all js are loaded on the homepage, which is more than the normal size. js files will not have much performance impact.

    https://oclazyload.readme.io/...

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-15 17:14:03

    Generally, all js will be merged into the app. After the page is referenced, the sub-page can also be used. If you do not merge it, you can also reference it directly in the page. However, angular projects generally have many directives, services, and controllers. These js will definitely not be merged. There will be many requests, which will affect the page loading speed

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-15 17:14:03

    Single page applications usually package and merge js files together

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-15 17:14:03

    Introduced in the entry file, the entire project can be used, and there is no need to blame which page uses which.

    reply
    0
  • 迷茫

    迷茫2017-05-15 17:14:03

    Single page applications generally package and merge js files together

    reply
    0
  • Cancelreply