split controller and rename it
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 11 Nov 2010 18:22:51 +0000 (19:22 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 11 Nov 2010 18:22:51 +0000 (19:22 +0100)
public/app/conference/symposiums.html
public/app/conference/symposiums.js [new file with mode: 0644]

index 33cf1e7..2be88a4 100644 (file)
@@ -1,26 +1,13 @@
-<script type="text/javascript"> 
-       TestCntl.$inject = ['$xhr', '$route']; 
+<!DOCTYPE HTML>
+<html xmlns:ng="http://angularjs.org">
+<head>
+<meta charset="utf-8">
+<script src="angular.js" ng:autobind></script>
 
-       function TestCntl(xhr, route){ 
+<title>Conference registration</title>
+<script type="text/javascript" src="symposiums.js"></script> 
 
-               this.route = route; 
-               this.xhr = xhr; 
-
-               var data = {}
-               this.data = data;
-
-               this.xhr("JSON"
-                       , "http://localhost:5984/conference/_design/symposium/_view/work_nr%2Ctitle?callback=JSON_CALLBACK"
-                       , function(code, response){ 
-                               console.log(code, response, data);
-                               data.response = response;
-                       }
-               ); 
-
-       } 
-</script> 
-
-<div ng:controller="TestCntl"> 
+<div ng:controller="Symposiums"> 
 
 <div ng:repeat="s in data.response.rows">
 <h1 ng:show="s.key[1] == 1">{{s.key[0]}}</h1>
@@ -33,3 +20,7 @@ data={{data}}
 </pre>
 
 </div> 
+
+
+</body>
+</html>
diff --git a/public/app/conference/symposiums.js b/public/app/conference/symposiums.js
new file mode 100644 (file)
index 0000000..7502e76
--- /dev/null
@@ -0,0 +1,20 @@
+
+Symposiums.$inject = ['$xhr', '$route']; 
+
+function Symposiums(xhr, route){ 
+
+       this.route = route; 
+       this.xhr = xhr; 
+
+       var data = {}
+       this.data = data;
+
+       this.xhr("JSON"
+               , "http://localhost:5984/conference/_design/symposium/_view/work_nr%2Ctitle?callback=JSON_CALLBACK"
+               , function(code, response){ 
+                       console.log(code, response, data);
+                       data.response = response;
+               }
+       ); 
+}
+