module.html
that contains the HTML for the module, A module.info
that contains the name, description, version and author of the module in JSON format, a module.js
file inside of the js/
folder that contains the AngularJS, and finally a module.php
file inside of the api/
folder. It is structured like this:/pineapple/modules/
.div
that is the width of the webpage. To do this, we will create a row, and then our div
element which will use the col-md-12
Bootstrap class.Your code should look like this:div
element with the argument ng-controller="ControllerName"
. For this example, our controller will be referred to as ExampleController
. This div is now able to interact with your AngularJS inside of the module.js
file.Your code should now look like this:hello
. This is done with {{hello}}
. Later, we will use this expression to display text from our PHP. You can learn more at AngularJS - Expression.Our HTML code should now look like this:registerController()
. This allows us to easily create controllers for our module. An empty controller would look like this:"ExampleController"
. Then we include our dependencies, usually the WiFi Pineapple API, with $api
and then the scope of your module, with $scope
.Now we will add a variable inside our scope called hello
, like so:$api.request()
function:$scope.hello
to response.text
.Module
class inside of the pineapple
namespace. We must then add the method to handle our requests.:getHello
. Once it finds getHello
it will execute a function called hello()
that we will define next. After the route() function: