JSFiddle - React, Tailwind, and code Playground

by Edwin Dalorzo

HTML

<script src="ttps://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
<div ng-app="SampleApp">
    <div ng-controller="MainCtrl"></div>
    </di>

JavaScript

var app = angular.module('SampleApp', []);

function ParentService($http) {
    this.$http = $http;
}
ParentService.prototype.foo = function () {
    alert("Hello World");
};

function ChildService($http) {
    ParentService.call(this, $http);
}

ChildService.prototype = new ParentService();
ChildService.prototype.bar = function(){
    alert(this.$http);
};

ChildService.inject = ['$http'];

app.service('child', ChildService);

app.controller('MainCtrl', ['$scope', 'child', function ($scope, child) {
    child.foo();
    child.bar();
}]);