From db6dfff19acbd6d47a373ec0b7c85c3c4a9fbd36 Mon Sep 17 00:00:00 2001 From: Romuald Quantin Date: Sat, 27 Oct 2012 03:33:19 +0100 Subject: [PATCH] test angular --- work/test1/app.js | 25 +++++++++++++++++++++++++ work/test1/index.html | 21 +++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 work/test1/app.js create mode 100644 work/test1/index.html diff --git a/work/test1/app.js b/work/test1/app.js new file mode 100644 index 000000000000..e6b28906ff17 --- /dev/null +++ b/work/test1/app.js @@ -0,0 +1,25 @@ +function Controller($scope, $element, $compile) { + console.log('init controller'); + var count = 0; + $scope.age = 21; + $scope.setName = function() { + $scope.name = "angular " + ++count; + } + $scope.addInterpolation = function() { + var p = document.createElement('p'); + p.setAttribute('id', 'p2'); + var t = document.createTextNode('a new node "{{name}}" inserted'); + p.appendChild(t); + $element[0].appendChild(p); + } + $scope.changeNode = function() { + var p = document.getElementById('p'); + var t = document.createTextNode('node changed "{{name}}"'); + p.appendChild(t); + } + $scope.compile = function() { + //$compile(document.getElementById('p'))($scope); + //$compile(document.getElementById('p2'))($scope); + $compile($element[0])($scope); + } +} diff --git a/work/test1/index.html b/work/test1/index.html new file mode 100644 index 000000000000..814039290d2b --- /dev/null +++ b/work/test1/index.html @@ -0,0 +1,21 @@ + + + + Codestin Search App + + + +
+

Hello {{name}} !!!

+ + + + +
+ + + + + + + \ No newline at end of file