I want to introduce other js files into angularjs. Here I want to introduce the image carousel plug-in in sister ui, which has similar needs. Usually this requires embedding js in the page
For example, something like this, if you introduce the js plug-in directly into the html, and then write it like this in the page, it will have no effect, and this requires jQuery, although I am in angular jQuery is not used... How should I configure angular?
$(function() {
$('.am-slider').flexslider({
// options
});
});
1. Load everything in HTML at once
2. Use the oclazyload plug-in
3. Use angular’s $q to write a file loading service
Using https://github.com/revolunet/angular-carousel can meet your requirements
It’s a question and answer for myself. Currently, requirejs is used to solve the dependency problems in the project.
First
main.js
is the entrance to the entire ng application. Here is where you add the plug-ins to be loadedWhen using app.js, the index.html page has a controller to start the application