JSFiddle - React, Tailwind, and code Playground
by Berguiga
HTML
<body ng-app='app'>
<div ng-controller='prSerFact'>
<strong>Service</strong>{{serviceOutPut}}<br/><br/>
<strong>Factory</strong>{{factoryOutPut}}<br/><br/>
<strong>Provider</strong>{{provideOutPut}}<br/>
</div>
</body>
JavaScript
var app = angular.module('app',[]);
var myFunction = function(){
this.name = "Default Name is Amine Berguiga";
this.$get = function(){
this.name = 'New Name is Muhamed Berguiga';
return 'Hello, you have a new Name from function myFunction.$get= '+this.name;
};
return "Return All Object";
};
//Add service to our module and affect to this service a function
app.service('nameOfService',myFunction);
//Add Factory to our module and affect to this Factory a function
app.factory('nameOfFactory',myFunction);
//Add Provide to our module and affect to this Provide a function
app.provider('nameOfProvide',myFunction);
app.controller('prSerFact',function($scope,nameOfService,nameOfFactory,nameOfProvide){
$scope.serviceOutPut = " myService return to me:: "+nameOfService;
$scope.factoryOutPut = " myfactory return to me:: "+nameOfFactory;
$scope.provideOutPut = " myprovide return to me:: "+nameOfProvide;
});