how to use function in angularjs