Tuesday, June 6, 2017

Can't bind to 'ngFor' since it isn't a known property of 'li'

The usage of *ngFor within the li or div element has changed .like an example given below states that #contact of contacts where #contact defines as local variable.

<li *ngFor="#contact of contacts"></li>

Instead of using #contact,kindly replace your code snippet with the following structure in order to declare local variables inside of structural directives.

<li *ngFor="let contact of contacts"

(click)="onSelect(contact)"

[class.clicked]="showDetail === true">

{{contact.firstName}} {{contact.lastName}}

</li>

Hope it will help you someDay.

Twitter @dotnetpiper

Can't bind to 'ngModel' since it isn't a known property of 'input'

This error may occur at your end during the Angular2 development, specially during creation of two way binding using [(ngModel)] with your Input type.

To fix this error kindly use the following in app.module.js and import the namespace like given below:

import { FormsModule } from '@angular/forms';

@NgModule({

declarations: [

AppComponent,

FirstComponent

],

imports: [

BrowserModule,FormsModule

],

providers: [],

bootstrap: [AppComponent]

})

As soon as you add this into the above given file.it should start work as anticipated.

Thursday, May 4, 2017

.Net Core Sample applications with examples

Here is an attachment for .Net core application which has the following area’s and those implementation

image

 

.Net Core Sample applications with examples

Regards

Sachin Kalia

Thursday, April 27, 2017

mark or make job as durable in Quartz .net?

Mark or make job as durable in Quartz .net?

 

This is the code segment to mark Job as durable in case you are not trigging through ITrigger.

public static ISchedulerFactory schedFact = new StdSchedulerFactory();
        IScheduler sched = schedFact.GetScheduler();

IJobDetail jobEOD = JobBuilder.Create<Facilities>().WithIdentity("Facilities").StoreDurably(true).Build();
                                        JobKey jobKey = JobKey.Create("Facilities");
                                        sched.AddJob(jobEOD, false);
                                        sched.TriggerJob(jobKey);

 

Categories: WCF and WebAPI

Tuesday, April 25, 2017

Exclude controllers methods from docs or swagger

Exclude controllers methods from docs or swagger

If you would like to ignore controller’s action method from documentation or swagger ,kindly out an annotation just above an action method.

 [ApiExplorerSettings(IgnoreApi = true)]

Thanks

Tuesday, April 18, 2017

There was an error running the selected code generator dotnet -aspnet-generator:

Error-Messages

Resolution for this issue is as given below:

Kindly put the following line of code into .csproj file if you have created the solution in Visual Studio 2017 under item group.

Open .csproj file either in notepad or desired editor .paste the following line in ItemGroup as shown below:

<ItemGroup>

<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />

  </ItemGroup>

Hope it’ll help you some day. Enjoy Coding.

Categories: AngularJS , MVC , WCF and WebAPI

 

Unable to resolve service for type 'Microsoft.Extensions.Configuration.IConfiguration' while attempting to activate

Error-Messages

Resolution:

Put this line in Startup.cs file under Configuration Services Method to inject dependency as shown below:

services.AddSingleton<IConfiguration>(Configuration);

// This method gets called by the runtime. Use this method to add services to the container.
       public void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddMvc();
           services.AddSingleton<IConfiguration>(Configuration);
            services.AddSingleton<IFirstService, FirstService>();
        }

Monday, April 17, 2017

ASP.NET Core 1.0 ConfigurationBuilder().AddJsonFile(“appsettings.json”); not finding file

Or

"The configuration file 'appsettings.json' was not found and is not optional. The physical path is

 

Related image

"The configuration file 'appsettings.json' was not found and is not optional. The physical path is

Resolution

I was working on .net core for the first time and confronted an issue during development.it was throwing an error in Startup class .it count not find appsettings.json file from current directory.

Here is the solution for that as depicted beloSmile with tongue out

put these lines in such a way may help to mitigate an issue:

 

var builder = new ConfigurationBuilder().AddJsonFile("appsettings.json");          
Configuration = builder.Build();

var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");           
Configuration = builder.Build();

Thanks

Warm Regards
Sachin Kalia

Tuesday, February 7, 2017

Problem Statement : Cannot launch program 'c:\Users\sachin.kalia\Documents\My Web Sites\duckType.ts'; setting the 'outFiles' attribute might help.

image

There was a problem during the development of typescript application was shown above.

It means after pressing F5 it doesn’t allow you to debug a program,In layman words there was a little confusion for compiler which file i should call first.

So to mitigate such issue just open launch.json file and change the path of "outFiles": [ "${workspaceRoot}/js/**/*.js" ], and give the correct path.

like I have given below: "outFiles": [ "${workspaceRoot}/out/**/*.js" ],

What I have replaced the actual path "outFiles": [ "${workspaceRoot}/js/**/*.js" ], to "outFiles":

Note : replaced “JS” with “OUT”.

Sunday, February 5, 2017

TYPESCRIPT with VISUAL STUDIO CODE

Sunday, January 8, 2017

Getting Started With TypeScript Using Visual Studio Code

This is a fresh series of articles to learn Typescript from scratch, using Visual Studio code. Visual Studio Code is the new editor given by Microsoft, as it’s a very rich tool in comparison to sublime text, although this is my personal observation.

There are certain prerequisites before you jump into Typescript. Kindly follow the given steps in order to start with TypeScript.

  1. TypeScript is a very rich language, which is written in JavaScript, which follows an object oriented concept also.You can download TypeScript latest version here. Currently, TypeScript 2.1 is now available.
  2. Kindly download Visual Studio Code here. The latest version 1.8 is now available.
  3. VS Code has support for JavaScript and TypeScript languages out-of-the-box, as well as Node.js debugging. However, to run a Node.js application, you will need to install Node.js runtime on your machine. Node Package Manager alias npm is required for TypeScript through VS Code. Kindly refer to this link to install NPM.

After following all of the above steps it’s time to verify the NPM, using command prompt.

Open the command prompt, and type the following statement - npm -v.

Here is a glimpse of Visual Studio Code


Install Typescript compiler using npm command

npm install -g typescript

It shows the screen given below after installing TypeScript compiler.

Once you are done with all the steps shown above, it's time to execute you first sample .ts file. I’ve created a file with the name test1.ts and it has content, as shown below in the image.

Open your command prompt and reach to the desired destination, wherever you have placed this file and execute the below command: tsc test.ts.

After running the statement shown above, it should create a test1.js file, which should also have the same contact as test1.ts file.

Now, you can also verify it, using node with the command: node test1.js is also depicted below in the image.

I hope you will have inferred the basics of TypeScript with Node and Visual Studio Code.

There is a lot more  in the upcoming articles.