title: How to use other Angular2 service inside an ngrx/Store reducer?
body: <p>New to both ngrx/Store and reducer. Basically, I have this reducer:</p>
  
  <pre class="lang-js prettyprint-override"><code>import {StoreData, INITIAL_STORE_DATA} from "../store-data";
  import {Action} from "@ngrx/store";
  import {
    USER_THREADS_LOADED_ACTION, UserThreadsLoadedAction, SEND_NEW_MESSAGE_ACTION,
    SendNewMessageAction
  } from "../actions";
  import * as _ from "lodash";
  import {Message} from "../../shared-vh/model/message";
  import {ThreadsService} from "../../shared-vh/services/threads.service";
  
  export function storeData(state: StoreData = INITIAL_STORE_DATA, action: Action): StoreData {
  
  
    switch (action.type) {
  
      case SEND_NEW_MESSAGE_ACTION:
        return handleSendNewMessageAction(state, action);
  
      default:
        return state
    }
  }
  
  function handleSendNewMessageAction(state:StoreData, action:SendNewMessageAction): StoreData {
  
    const newStoreData = _.cloneDeep(state);
  
    const currentThread = newStoreData.threads[action.payload.threadId];
  
    const newMessage: Message = {
      text: action.payload.text,
      threadId: action.payload.threadId,
      timestamp: new Date().getTime(),
      participantId: action.payload.participantId,
      id: [need a function from this service: ThreadsService]
    }
  
    currentThread.messageIds.push(newMessage.id);
  
    newStoreData.messages[newMessage.id] = newMessage;
  
    return newStoreData;
  }
  </code></pre>
  
  <p>The problem is within the reducer function, I do not know how to inject an injectable service I created in a different file and use the function within it. The id part - I need to generate a firebase push ID using function like this.threadService.generateID() ... </p>
  
  <p>But since this is a function, I do not have a constructor to use DI and I have no idea how to get functions within threadService!</p>