JSFiddle - React, Tailwind, and code Playground

by Rodolfo Hernandez

HTML

<div ng-app="myApp">
    <div ng-controller="myController">
        <button ng-click="parent()">execute parent</button>
    </div>
</div>

JavaScript

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

    var parent = function($scope){
        $scope.parent = function(){
            alert('parent method');
        }
    };

    // you could do some prototyping as well
//parent.prototype.parent2 = function(){
//    alert('parent2 method');
//};

    var child = function($scope){
        parent.call(this, $scope);
        //$scope.parent2 = this.parent2;
    };
    child.prototype = Object.create(parent.prototype);
    child.prototype.constructor = child;
    
    
app.controller('parent', parent);

app.controller('myController', child);