calling the API from angulare directive and formular