please tell me what is angular service and module ? is angular service used to consume dotnet web service/ wcf service or web api ?
i need a small and complete code for angular module sample by which i can learn how to write it.
i need a small and complete code for angular service sample by which i can learn how to write it.
looking for help.
Syed ShanuPosted Mar 20, 2015, 5:23 AM
Posted Mar 19, 2015, 9:26 AM
i guess module means when people write many javascript functions in file. suppose i have few function written in my validate.js file. so i guess validate.js file will be called a module.
can u show me how to load a module by angular and how to call any specific function from module by angular and also need to pass parameter as value for function call. thanks
Syed ShanuPosted Mar 19, 2015, 4:53 AM
var app;
(function () {
app = angular.module("YourModule Name", []);
})();
[] is used to add your parameter its like similar like in function we pass the parameter.
and for service in detail kindly go through the link which i provided in my previous answer.
and also check this link for very simple understanding of AngularJs.
http://www.w3schools.com/angular/angular_modules.asp
Posted Mar 19, 2015, 4:46 AM
Syed ShanuPosted Mar 19, 2015, 4:23 AM
Module: This is is initial process to create our AngularJs program.for example we can say Console and Windows program has main Maethod as default methot to start execution ,Smimilarly for AngularJs,The execution start from Module.
for module we use like this:Here we give Module name
var app;
(function () {
app = angular.module("RESTClientModule", []);
})();
Service:Using Service we can perform all our Business logic .For example we can fetch the data and pass the data to Controller to bind in our View.
For Example
app.service("AngularJs_WCFService", function ($http) {
// Here we can write our own methods
});
Kindly check this referance website for moer details about Module and Service
http://rob.conery.io/2013/04/25/models-and-services-in-angular/
http://viralpatel.net/blogs/angularjs-service-factory-tutorial/
Suraj SahooPosted Mar 19, 2015, 4:23 AM
Please follow the below link for a very nice and effective article for your query.
http://viralpatel.net/blogs/angularjs-service-factory-tutorial/
I hope this helps.
Accept if helps.
Thanks