I am using basic xampp for my programming web applications Until now I have used php for the same.
But now i have switched to angularjs
I couldn't see anywhere the tutorial for server communication without nodejs
as I'm not comfortable using nodejs as per now i want direct use of angularjs for web applications; like for fetching and adding data into the database.
<body id="index" ng-app="notesApp" >
<h1>Hello servers!</h1>
<div ng-controller="maincntrl as cntrl" ng-repeat="todo in cntrl.items" class="item">
<div><span ng-bind="todo.label"></span></div>
<div>- <span ng-bind="todo.author"></span></div>
</div>
<script>
angular.module('notesApp',[])
.controller('mainCntrl',['$http', function($http){
var self= this;
self.items = [];
$http.get('/api/note').then(function(response){},function(errResponse){
console.error("error while fetching note");
});
}]);
</script>
</body>
THis code is not working
The point is, Angular JS is a client side framework. It doesn't matter what you use in server side.
Here is an example of server communication with PHP.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.