0

Is there a possibility to make a custom function like you can do with PHP? For example:

<?php

function helloWorld(){
  return 'Hello world!';
}

I would like to call a function like [[myFunction(parameter)]]

EDIT: I want to make a JavaScript function that returns a value. In example:

function helloWorld(){
    return 'Hello from the Func!';
}

When a angular template gets called, i want to call that function like: {{helloWorld()}}, no matter what scope or controller I'm using.

So, I want helloWorld() to be available on any scope.

The thing is: if you bind it to the scope, you can call it only when that specific controller is loaded... I want to call this function everywhere

Meligy
  • 35,654
  • 11
  • 85
  • 109
Donny van V
  • 921
  • 1
  • 10
  • 22
  • Could you please elaborate, because I can't figure out what you're asking, and what you want to achieve. – JB Nizet Jan 02 '16 at 22:59
  • So you want a function that is run each time any controller is loaded or once at the beginning of the app? – George Stocker Jan 02 '16 at 23:05
  • Actually i found a solution for my issue. The word i was searching for was Global Function. I can add my function to the rootScope and call it from there... http://stackoverflow.com/questions/15025979/can-i-make-a-function-available-in-every-controller-in-angular – Donny van V Jan 02 '16 at 23:06

0 Answers0