1

I am using basic for my programming web applications Until now I have used for the same.

But now i have switched to

I couldn't see anywhere the tutorial for server communication without

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

1
  • 1
    You can't use angular to directly access the db (as it is client side), And you can use php or node on the server. Having said that, if you have no experience in node you can use php for the ajax call from angular side. You can have a look at my article where i have used angular with php. baljeetsingh.in/blog/… Commented Dec 8, 2015 at 6:02

1 Answer 1

1

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.

http://www.w3schools.com/angular/angular_sql.asp

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.