What's the parameter list of function RootController in ui/chrome?

I found there are a couple of examples on ui/chrome, but I am a little confused why the RootController function has different paramter list in different examples, and how the paramters get passed to the RootController. Thanks!

Example 1: The RootController function has 3 parameters ($http, buildNum, buildSha). I don't know who passes the parameters to this RootController?

const chrome = require('ui/chrome')
.setRootTemplate(require('plugins/status_page/status_page.html'))
.setRootController('ui', function ($http, buildNum, buildSha) {
......
}

Example 2: The RootController function has no parameter at all.

require('ui/chrome')
.setRootTemplate(require('./index.html'))
.setRootController(function () {
......
}

Hey @ahrtr, this is an AngularJS construct where you specify your list of dependencies that you wish to be injected and they're provided to you. I'd recommend familiarizing yourself with AngularJS's dependency injection here

@Brandon_Kobel
Thanks for the info, which is exactly what I want.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.