From 5604bf6d69052816338789e84ba25ef1b8ce8d16 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 28 Oct 2015 16:01:55 -0700 Subject: [PATCH] [Representation] Add template tester ...to simply verification of mct-include/mct-representation behavior. --- example/templates/bundle.json | 17 +++++++++++++++++ example/templates/res/templates.html | 14 ++++++++++++++ .../templates/src/TemplateTestingController.js | 18 ++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 example/templates/bundle.json create mode 100644 example/templates/res/templates.html create mode 100644 example/templates/src/TemplateTestingController.js diff --git a/example/templates/bundle.json b/example/templates/bundle.json new file mode 100644 index 0000000000..38989c408c --- /dev/null +++ b/example/templates/bundle.json @@ -0,0 +1,17 @@ +{ + "extensions": { + "routes": [ + { + "when": "/templates", + "templateUrl": "templates.html" + } + ], + "controllers": [ + { + "implementation": "TemplateTestingController.js", + "key": "TTC", + "depends": [ "$scope", "objectService" ] + } + ] + } +} diff --git a/example/templates/res/templates.html b/example/templates/res/templates.html new file mode 100644 index 0000000000..ac2747acaa --- /dev/null +++ b/example/templates/res/templates.html @@ -0,0 +1,14 @@ +
+
+
mct-include
+ + +
+ +
+
mct-representation
+ + + +
+
diff --git a/example/templates/src/TemplateTestingController.js b/example/templates/src/TemplateTestingController.js new file mode 100644 index 0000000000..ccb4223603 --- /dev/null +++ b/example/templates/src/TemplateTestingController.js @@ -0,0 +1,18 @@ +/*global define*/ +define([], function () { + 'use strict'; + + return function TemplateTestingController($scope, objectService) { + $scope.ikey = ''; + $scope.rkey = ''; + $scope.rid = ''; + $scope.obj = undefined; + + $scope.$watch('rid', function (id) { + $scope.obj = undefined; + objectService.getObjects([id]).then(function (objs) { + $scope.obj = objs[id]; + }); + }); + }; +});