[Example] Add controller example

Add example showing declarative registration of
controllers with Angular. WTD-518.
This commit is contained in:
Victor Woeltjen 2014-11-04 15:28:53 -08:00
parent 0e6f419678
commit b712c9a401
3 changed files with 28 additions and 2 deletions

View File

@ -3,7 +3,11 @@
"description": "Example showing how to declare extensions with built-in support from Angular.",
"extensions": {
"controllers": [
{
"key": "ExampleController",
"implementation": "ExampleController.js",
"depends": [ "$scope" ]
}
],
"directives": [

View File

@ -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>

View 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;
}
);