diff --git a/login/app.js b/login/app.js new file mode 100644 index 0000000..9d56fd2 --- /dev/null +++ b/login/app.js @@ -0,0 +1,31 @@ +var mongoose= require('mongoose'); +var express=require('express'); +var bodyParser=require('body-parser'); +mongoose.connect('mongodb://localhost:27017/test'); +var urlencodedParser=bodyParser.urlencoded({extended:true}); +var Employee=require('./js/employee.js'); +var app=express(); +var router=express.Router(); +var multer=require('multer'); +router.get("/employee",function(){ + Employee.find({},function(err,employee){ + if(!err){ + console.log(employee); + res.json(employee) + } + }); + +}); +router.get("/employee/name",function(){ + Employee.find({},"-_id Name",function(err,employee){ + res.json(employee) + }) +}) + + +router.post(); +router.put(); +router.delete(); + +app.use(urlencodedParser); +app.use('/api',router); diff --git a/login/index.html b/login/index.html new file mode 100644 index 0000000..76dfa6d --- /dev/null +++ b/login/index.html @@ -0,0 +1,24 @@ + + + + + + Title + + + + + + + + + + + + + + + +
+ + \ No newline at end of file diff --git a/login/js/app.js b/login/js/app.js new file mode 100644 index 0000000..b22599c --- /dev/null +++ b/login/js/app.js @@ -0,0 +1,103 @@ +/** + * Created by lcom64 on 6/2/17. + */ +angular.module('myapp',['ngRoute','ui.bootstrap','angularModalService','ngAnimate','ngFileUpload']) + .config(function($routeProvider){ + $routeProvider + .when('/',{ + templateUrl:'views/login.html', + controller:'mainController' + }) + .when('/list',{ + templateUrl:'views/list.html', + controller:'listController' + }) + }) + .controller('mainController',function($scope,$location){ + $scope.submit=function(){ + $location.path('/list'); + } + }) + .controller('listController',function($scope,$http){ + $scope.items=['hdhsjhfshf','dshgsjhchb']; + $scope.status={ + isopen:false + }; + $scope.toggled=function(open){ + console.log("open"); + }; + $scope.toggleDropDown=function($event){ + $event.preventDefault(); + $event.stopPropagation(); + $scope.status.isopen = !$scope.status.isopen; + }; + $scope.appendToEl = angular.element(document.querySelector('#dropdown-long-content')); + $scope.emp = []; + function getUser(){ + $http + .get('http://localhost:8000/api/user') + .then(function (d) { + $scope.emp= d.data; + //$scope.emp=d; + })}}) +.controller('ComplexController', [ + '$scope', '$element', 'title', 'close', + function($scope, $element, title, close) { + + $scope.name = null; + $scope.employee = null; + $scope.title = title; + + // This close function doesn't need to use jQuery or bootstrap, because + // the button has the 'data-dismiss' attribute. + $scope.close = function() { + close({ + name: $scope.name, + age: $scope.employee, + }, 500); // close, but give 500ms for bootstrap to animate + }; + + // This cancel function must use the bootstrap, 'modal' function because + // the doesn't have the 'data-dismiss' attribute. + $scope.cancel = function() { + + // Manually hide the modal. + $element.modal('hide'); + + // Now call close, returning control to the caller. + close({ + name: $scope.name, + age: $scope.age + }, 500); // close, but give 500ms for bootstrap to animate + }; + + function add(){ + Upload.upload({ + url: 'http://localhost:8001/api/user', + method: 'POST', + data: { + 'name': $scope.name, + 'customer':$scope.employee + } + }) + }}] + ) +.controller('SampleController', ['$scope', 'ModalService', function($scope, ModalService){ + $scope.showComplex = function() { + + ModalService.showModal({ + templateUrl: "views/modal.html", + controller: "ComplexController", + inputs: { + title: "A More Complex Example" + } + }).then(function(modal) { + // modal.element.modal(); + modal.close.then(function(result) { + $scope.complexResult = "Name: " + result.name + ", EmployeeName: " + result.employee; + }); + }); + + } +}]); + diff --git a/login/js/employee.js b/login/js/employee.js new file mode 100644 index 0000000..e2ea96f --- /dev/null +++ b/login/js/employee.js @@ -0,0 +1,13 @@ +/** + * Created by lcom64 on 6/2/17*/ +var mongoose=require('mongoose'); +var Schema=mongoose.Schema; +var EmployeeSchema= new Schema({ + Name:String, + EmployeeId:[{ type: Schema.Types.ObjectId, ref: 'Employee' }], + File:String +}); +//var mongoose=require('mongoose'); +//var Schema=mongoose.Schema; + +module.exports=mongoose.model('Employee',EmployeeSchema); \ No newline at end of file diff --git a/login/views/list.html b/login/views/list.html new file mode 100644 index 0000000..1397e12 --- /dev/null +++ b/login/views/list.html @@ -0,0 +1,24 @@ +
+ +
+ +
+
+

Show Complex

+
{{complexResult}}
+
+ + + + + + +
+ {{emp.Name}} + + {{emp.File}} + + {{emp.}} +
+ \ No newline at end of file diff --git a/login/views/login.html b/login/views/login.html new file mode 100644 index 0000000..18ec67f --- /dev/null +++ b/login/views/login.html @@ -0,0 +1,11 @@ +
+ + + + +
+ + + +
+
diff --git a/login/views/modal.html b/login/views/modal.html new file mode 100644 index 0000000..5d7f396 --- /dev/null +++ b/login/views/modal.html @@ -0,0 +1,39 @@ + \ No newline at end of file