Having issues using Schedule in my application

I have ASP.NET Core MVC with Angular test application that I am using Schedule control on. I am attaching the project with this. The url is http://localhost:62769/Shop/Index. But each time I get the following error -
Uncaught Error: Template parse errors:
Can't bind to 'selectedDate' since it isn't a known property of 'ejs-schedule'.
1. If 'ejs-schedule' is an Angular component and it has 'selectedDate' input, then verify that it is part of this module.
2. If 'ejs-schedule' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
    <div class="col-md-9">
        
        <ejs-schedule #schedule height='550px' [ERROR ->][(selectedDate)]="selectedDate" [eventSettings]="eventSettings"></ejs-schedule>
    </div>
</div>
"): ng:///AppModule/AppComponent.html@10:47
Can't bind to 'eventSettings' since it isn't a known property of 'ejs-schedule'.
1. If 'ejs-schedule' is an Angular component and it has 'eventSettings' input, then verify that it is part of this module.
2. If 'ejs-schedule' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("ol-md-9">
        
        <ejs-schedule #schedule height='550px' [(selectedDate)]="selectedDate" [ERROR ->][eventSettings]="eventSettings"></ejs-schedule>
    </div>
</div>
"): ng:///AppModule/AppComponent.html@10:79
'ejs-schedule' is not a known element:
1. If 'ejs-schedule' is an Angular component, then verify that it is part of this module.
2. If 'ejs-schedule' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
    <div class="col-md-9">
        
        [ERROR ->]<ejs-schedule #schedule height='550px' [(selectedDate)]="selectedDate" [eventSettings]="eventSettings"): ng:///AppModule/AppComponent.html@10:8
    at syntaxError (compiler.js:1016)
    at TemplateParser.push.../node_modules/@angular/compiler/fesm5/compiler.js.TemplateParser.parse (compiler.js:14813)
    at JitCompiler.push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._parseTemplate (compiler.js:24000)
    at JitCompiler.push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileTemplate (compiler.js:23987)
    at compiler.js:23930
    at Set.forEach (<anonymous>)
    at JitCompiler.push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileComponents (compiler.js:23930)
    at compiler.js:23840
    at Object.then (compiler.js:1007)
    at JitCompiler.push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents (compiler.js:23839)
syntaxError @ compiler.js:1016
push.../node_modules/@angular/compiler/fesm5/compiler.js.TemplateParser.parse @ compiler.js:14813
push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._parseTemplate @ compiler.js:24000
push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileTemplate @ compiler.js:23987
(anonymous) @ compiler.js:23930
push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileComponents @ compiler.js:23930
(anonymous) @ compiler.js:23840
then @ compiler.js:1007
push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents @ compiler.js:23839
push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler.compileModuleAsync @ compiler.js:23799
push.../node_modules/@angular/platform-browser-dynamic/fesm5/platform-browser-dynamic.js.CompilerImpl.compileModuleAsync @ platform-browser-dynamic.js:143
push.../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModule @ core.js:4352
./src/main.ts @ main.ts:13
__webpack_require__ @ bootstrap:76
0 @ dataService.ts:5
__webpack_require__ @ bootstrap:76
checkDeferredModules @ bootstrap:43
webpackJsonpCallback @ bootstrap:30
(anonymous) @ main.js:1

Attachment: WebApplication1_73f250d6.zip

10 Replies

AA Arulraj A Syncfusion Team August 14, 2018 11:34 AM UTC

Hi Ameet, 

Thanks for contacting Syncfusion support. 

We have analyzed the reported scenario with the shared sample and found that some of the necessary application configuration were missed in the sample. Therefore, we have added those missing configuration changes in the shared sample and resolved the issue. Please find the modified sample from the following location. 


Please refer to the following code changes made in the above sample to overcome the reported issue. 

App.module.ts file: 

import { BrowserModule } from '@angular/platform-browser'; 
--------------------------- 
--------------------------- 
--------------------------- 
 
import { ScheduleAllModule, RecurrenceEditorAllModule } from '@syncfusion/ej2-ng-schedule'; 
--------------------------- 
--------------------------- 
--------------------------- 
 
@NgModule({ 
    declarations: [ 
        AppComponent 
    ], 
    imports: [ 
        BrowserModule 
        , HttpClientModule, ScheduleAllModule // Here we need to import the modules which are used in the application 
    ], 
    providers: [ 
        DataService 
    ], 
    bootstrap: [AppComponent] 
}) 
export class AppModule { } 

ClientApp/src/index.html page: 

<body> 
  <the-shop></the-shop> 
</body> 
</html> 

Startup.cs page: 

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Threading.Tasks; 
using Microsoft.AspNetCore.Builder; 
using Microsoft.AspNetCore.Hosting; 
using Microsoft.AspNetCore.SpaServices.AngularCli; 
using Microsoft.Extensions.Configuration; 
using Microsoft.Extensions.DependencyInjection; 
 
namespace WebApplication1 
{ 
    public class Startup 
    { 
// This method gets called by the runtime. Use this method to add services to the container. 
        public void ConfigureServices(IServiceCollection services) 
        { 
            services.AddMvc(); 
            services.AddSpaStaticFiles(configuration => 
            { 
                configuration.RootPath = "ClientApp/dist"; 
            }); 
        } 
 
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 
        public void Configure(IApplicationBuilder app, IHostingEnvironment env) 
        { 
            if (env.IsDevelopment()) 
            { 
                app.UseBrowserLink(); 
                app.UseDeveloperExceptionPage(); 
            } 
            else 
            { 
                app.UseExceptionHandler("/Home/Error"); 
            } 
 
            app.UseSpaStaticFiles(); 
            app.UseMvc(); 
            app.UseSpa(spa => 
            { 
                spa.Options.SourcePath = "ClientApp"; 
                if (env.IsDevelopment()) 
                { 
                    spa.UseAngularCliServer(npmScript: "start"); 
                } 
            }); 
 
            app.UseMvc(routes => 
            { 
                routes.MapRoute( 
                    name: "default", 
                    template: "{controller=Home}/{action=Index}/{id?}"); 
            }); 
        } 

Style.css page: 

/* You can add global styles to this file, and also import other style files */ 
@import url('../node_modules/@syncfusion/ej2-schedule/styles/material.css'); 

Also, include the following packages before running the sample to run the sample properly. 

  1. Microsoft.AspNetCore.SpaServices.Extensions

Sample Output: 

 

Kindly try with the above sample and code example and let us know if you need any further assistance on this. 
Regards, 
Arulraj A 



AM Ameet August 14, 2018 11:55 PM UTC

Thank you for your quick response. This is the ASP.NET core MVC in which I have integrated Angular application. So I could not use the SPA related code. But thanks for pointing out what I was missing. I was missing importing ScheduleAllModule in my code. As soon as I added that it worked.

Thank you very much for your help. You guys are just awesome.

@NgModule({ 
    declarations: [ 
        AppComponent 
    ], 
    imports: [ 
        BrowserModule 
        , HttpClientModule, ScheduleAllModule // Here we need to import the modules which are used in the application 
    ], 
    providers: [ 
        DataService 
    ], 
    bootstrap: [AppComponent] 
}) 
export class AppModule { } 


AA Arulraj A Syncfusion Team August 15, 2018 08:36 AM UTC

Hi Ameet, 
 
Thanks for the update. 
 
We are glad to hear that the problem has been resolved. Please let us know if you have any further queries, we are happy to help you. 

Thanks, 
Arulraj A 



AM Ameet August 15, 2018 02:35 PM UTC

Another question - When the event is updated by the administrator how do I trigger the save event to push it to my REST WEB API?

Thanks,

Ameet


AA Arulraj A Syncfusion Team August 17, 2018 07:23 AM UTC

Hi Ameet, 

Thanks for the update. 

You can achieve the mentioned requirement by pushing the appointment details to the REST WEB API method by using our DataManager’s “url” and “crudUrl” support. Please refer to the following code example to meet this requirement. 

app.component.ts page: 

import { Component, ViewEncapsulation } from '@angular/core'; 
import { MonthService, DayService, WeekService, WorkWeekService, EventSettingsModel, ActionEventArgs } from '@syncfusion/ej2-ng-schedule'; 
import { UrlAdaptor, DataManager } from '@syncfusion/ej2-data'; 
 
@Component({ 
  selector: 'app-root', 
  templateUrl: './app.component.html', 
  styleUrls: ['./app.component.css'], 
  providers: [DayService, WeekService, WorkWeekService, MonthService], 
  encapsulation: ViewEncapsulation.None 
}) 
export class AppComponent { 
  public showQuickInfo: boolean = false; 
  public selectedDate: Date = new Date(2018, 6, 25); 
  private dataManger: DataManager = new DataManager({ 
    url: 'http://localhost:54738/Home/LoadData', // Here pass your REST WEB API load data 
    crudUrl: 'http://localhost:54738/Home/UpdateData', // Here pass your REST WEB API update data 
    adaptor: new UrlAdaptor 
  }); 
  public eventSettings: EventSettingsModel = { dataSource: this.dataManger }; 
} 
 
 
 



Note: Run the service project before running the angular sample to save the appointment in the database. Also, if you wish to perform any authentication while performing CRUD operation you can do it in application level. For example, if you are updating an event it will call the “UpdateData” method and there you can check the user is valid or not and prevent or proceed the action. 

Please try the above sample and code example and let us know if you need any further assistance on this. 

Regards, 
Arulraj A 



AM Ameet August 22, 2018 01:44 AM UTC

Thanks for your quick response. Can you guide me on how I can group the calendar with the resources coming from another REST WebAPI as well? I have opened another thread because I was not sure if you can respond on this.

Regards,

Ameet


AM Ameet August 22, 2018 10:11 PM UTC

My fault forgot JSON was case sensitive between what was returning back from the database. It is working now.


AA Arulraj A Syncfusion Team August 23, 2018 04:46 AM UTC

Hi Ameet, 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved. Please let us know if you have any further queries on this, we are happy to help you. 
 
Arulraj A  



AM Ameet August 26, 2018 11:54 PM UTC

So, I have azure function that has to be used with the CRUD url? Does the Data Manager pass a json object to the web service? What is the format of the JSON object. 

My datamanager syntax is -
this.dataManger = new DataManager({
                       url: 'https://mysamay.azurewebsites.net/api/GetMyEvents?code=IFFTY3FCKTLmDUUd8lgrstBGK1oGbbC2uvEtUOotWvK64CDSGaq8Rg==', // Here pass your REST WEB API load data 
                       crudUrl: 'https://mysamay.azurewebsites.net/api/ManageEvents?code=Ru/yxWgtVwvKAQVqCTQHnMPXQjXWiMWCJ1l829YKAPiIC7OONG6Iyw==',
                       adaptor: new UrlAdaptor
                   }); 

The event settings is -
this.eventSettings = {
                       dataSource: this.dataManger,
                       fields: {
                           id: 'EventID',
                           subject: { name: 'EventName' },
                           isAllDay: { name: 'IsAllDay' },
                           description: { name: 'EventDescription' },
                           startTime: { name: 'StartDateTime' },
                           endTime: { name: 'EndDateTime'}
                       }
                   };

My HTML is -
<ejs-schedule #scheduleObj width="100%" height='550px' cssClass='schedule-group' [(selectedDate)]="selectedDate" [eventSettings]="eventSettings" [group]="group"
                      [(currentView)]="scheduleView" (popupOpen)="onPopupOpen($event)">
            <e-resources>
                <e-resource field='GroupID' title='Calendars' [dataSource]='resourceDataSource' [allowMultiple]='allowMultiple' name='Calendars'
                            textField='GroupName' idField='GroupID' colorField='CalendarColor' [query]="querySource" >
                </e-resource>
            </e-resources>

        </ejs-schedule>

Thanks for your help again?

I just would like to know what format is the JSON object that gets send to the url so I can work on it on the Azure side.

Thanks,

Ameet


AA Arulraj A Syncfusion Team August 27, 2018 05:13 PM UTC

Hi Ameet, 

Please find the following screenshot to know about the details of the JS2 Schedule control LoadData and UpdateData method request and its passing JSON object details. 

LoadData: [To get the data on initial load] 

We are passing the StartDate and EndDate  value along with the LoadData method as shown below. 

 

UpdateData: [Performing CRUD action] 

We are passing the newly created appointment details in the value argument and current action (ex: insert) in the action as shown below. 

 

While updating the appointment details will passed as shown below. 

 

When deleting the record the appointment details will be passed as shown below. 

 

Kindly check with the above screenshots and let us know if any other concerns on this. 
 
Arulraj A 


Loader.
Up arrow icon