How to make a universal function which can be called anywhere from app?

I have a problem while developing an angular 2 app. Can you help me please.
My question is how to make a universal function which can be run from any controller? In ionic 1 i used to create create all_controller or some universal controller which functions could be called from anywhere on the app like this.

<body ng-app="starter" ng-controller="all_controller" ></body>

Is there something like this on ionic 2? Or some alternative method?

universal function is under window.
so js-file(write universal function) read in www/build/index.html. so this can use all conponent.

for example ( using function ace() )

index.html.

script src=“https://cdn.rawgit.com/ajaxorg/ace-builds/v1.2.0/src-min-noconflict/ace.js”>

and

hoge.ts

declare var ace: any;

@Component({
templateUrl: ‘build/pages/hoge.html’,
})
export class hogePage
{
editor:any;

ngOnInit()
{
    //editorの設定
    this.editor = ace.edit("css_editor");
    this.editor.setTheme("ace/theme/tomorrow_night_bright");

But angular2 way is support providers. I think you should use providers.

regards.