AngularJS TypeError: is not a function

Viewed 214

I'm trying to understand why I'm getting this error, I tried to put roomService.isExist inside a function and call it but same error occurs

roomService.isExist is not a function

This is what is inside my controller:

import { roomService } from 'roomService';
angular.module('roomCreation', ['api'])
  .controller('RoomController', ($scope, $element, $timeout, Api) => {
    const nameInput = $element[0].querySelector('input');
    $scope.room = Api.getRoom();
    $scope.$watch('elements[0].name', () => {
      roomService.isExist($scope.room.name, $scope.room.domainId).then((response) => {
        console.log(response)
      })
      $scope.setValid((!!$scope.elements[0].name));

    });
    $timeout(() => {
      domUtils.putCursorAtEnd(nameInput);
    });
  });
<div class="Room-nameEditor" ng-controller ="RoomController">
  <form name="linkForm">
    <fieldset>
      <input type="text" name="template" ng-model="elements[0].name" id="in" clearable/>
    </fieldset>
  </form>
</div>

0 Answers
Related