mirror of
https://github.com/nasa/openmct.git
synced 2025-06-06 01:11:41 +00:00
[Example] Add controller example
Add example showing declarative registration of controllers with Angular. WTD-518.
This commit is contained in:
parent
0e6f419678
commit
b712c9a401
@ -3,7 +3,11 @@
|
|||||||
"description": "Example showing how to declare extensions with built-in support from Angular.",
|
"description": "Example showing how to declare extensions with built-in support from Angular.",
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"controllers": [
|
"controllers": [
|
||||||
|
{
|
||||||
|
"key": "ExampleController",
|
||||||
|
"implementation": "ExampleController.js",
|
||||||
|
"depends": [ "$scope" ]
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"directives": [
|
"directives": [
|
||||||
|
|
||||||
|
@ -1 +1,2 @@
|
|||||||
<p>Hello, world! I am the default route.</p>
|
<p>Hello, world! I am the default route.</p>
|
||||||
|
<p ng-controller="ExampleController">My controller has told me: "{{phrase}}"</p>
|
21
example/builtins/src/ExampleController.js
Normal file
21
example/builtins/src/ExampleController.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*global define,Promise*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module defining ExampleController. Created by vwoeltje on 11/4/14.
|
||||||
|
*/
|
||||||
|
define(
|
||||||
|
[],
|
||||||
|
function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function ExampleController($scope) {
|
||||||
|
$scope.phrase = "I am a controller.";
|
||||||
|
}
|
||||||
|
|
||||||
|
return ExampleController;
|
||||||
|
}
|
||||||
|
);
|
Loading…
x
Reference in New Issue
Block a user