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

app.controller('MainCtrl', function($scope) {
  $ = 'World';

<!DOCTYPE html>
    <meta charset="utf-8" />
    <title>Global Functions in AngularJs </title>
    <link rel="stylesheet" href="style.css" />
    <script src=""></script>
        var app = angular.module('myApp', []);

        //This is global functions for every controler. ($rootScope, $window) {
            $rootScope.myGlobalFunction = function () {
                //TODO : your custom code here.
                $window.alert('I am global function. :)');
                console.log("I am global function. :)");

        //This is controller for accessing to global functions.
        app.controller('MainCtrl', function ($scope) {
            //TODO: your controller code here.
<body ng-app="myApp" ng-controller="MainCtrl">
    <p class="txt">Global Functions in AngularJs</p>
    <div ng-init="myGlobalFunction()">
            <a href="">Click for know about me. :)</a>
        <button class="btn" ng-click="myGlobalFunction()">Click and call global function</button>
/* Put your css in here */

.btn {
        border: 1px solid #3366FF;
        background-color: #B3C6FF;