B
B
bio2016-07-15 11:33:49
Angular
bio, 2016-07-15 11:33:49

How to make PhpStorm highlight service methods in angular?

Good afternoon!
Code example:

//demo.controller.js

"use strict";

/**
 * @ngInject
 */
class DemoController {

    constructor($element, ClientService) {

        $element.on('click', () => {
            ClientService.getClientsList().then((clients)=> {
                console.log(clients);
            })
        });
    }
}

export default DemoController;

//client.service.js

"use strict";

class ClientService {
    /**
     * @ngInject
     * @param $http
     */
    constructor($http) {
        this.$http   = $http;
    }

    getClientsList() {
        return this.$http.get('/clients').then((response) => response.data.clients )
    }
}

export default ClientService;

Tried to import ClientService into the current file, but highlighting still doesn't work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2016-07-15
@bioforge

With good old JS only JSDoc

/**
   * 
   * @param $element
   * @param {ClientService} ClientService
   */
  constructor($element, ClientService) {

        $element.on('click', () => {
            ClientService.getClientsList().then((clients)=> {
                console.log(clients);
            })
        });
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question