What does the define function do in AngularJS?

angularjs, requirejs

Solution

Its probably because you're assuming its an Angular function. I believe this is RequireJS.

http://requirejs.org/docs/api.html#define

Problem

Sometimes I see code that looks like this in Angular: ``` define(['angular', 'module'], function (angular, module) { //... }); ``` What does this do? Whenever I've tried to search for "angularjs define" or "angularjs define function" I see results like "How to define a function in AngularJS" or "AngularJS Defined." This happens with search engines, and typing this into the search box on the AngularJS website doesn't help either. Where is the documentation for this?

Original source