Question: That question is continues my last question
[No provider for ObservableDataService](https://stackoverflow.com/questions/35484714/no-provider-for-observabledataservice)

So, i have application wide service `UploadedTemplatesService` which must be singleton. That service have one dependency - `ObservableDataService` and that dependency must create for that singletone `UploadedTemplatesService` only once, but `ObservableDataService` can be used in other services too and that service must inject for each other services as new object each time.

Must important note - i want to use `UploadedTemplatesService` inside Route hook too, so i added to bootstrap `.then` method and inside `.then` add appRef.injector inside `AppInjector` function.
`AppInjector` code:

```

```
export const AppInjector = (injector?: Injector): Injector => {
    if (injector) {
        appInjectorRef = injector;
    }
    return appInjectorRef;
};

```

```

So after that, i can get `UploadedTemplatesService` inside Route hook in way like `Injector.get(UploadedTemplateService)`.

So, i looked at documentation and tryed to write something like

```

```
bootatrap(AppComponent, [
    provide(UploadedTemplatesService, {
        useFactory: () => {
            return new UploadedTemplatesService(new ObservableDataService());
        }
    })
])

```

```

But that code throw new error: `Cannot read property 'getOptional' of undefined`

What i done wrong?

Answer: 
Try this

Use moment for format as fullcalendar use moment library for date.

No need of \_d just start

```
select: function(start, end, allDay)
            {
                addEditEvent("select",event,start,end);
            },

 function addEditEvent(state,event,start,end)
    {
       if(state=="select")
        { 
           console.log(moment(start).format('YYYY-MM-DD'));  
        }
    }

```
```
titleFormat: {
    day: 'dddd, d MMM, yyyy'   //whatever date format you want here
}

```