Educircle provides professional training by 6+ years experienced web design trainer. We provide for your live project training along with Website designing certification. We conduct Regular Classroom training only weekdays. We will support your Resume & Interview Preparation.
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
ā Live Streamingā Interactive Chatā Private Showsā HD Quality
Anya is LIVE right now
FREE
Free to watch ⢠No registration required ⢠HD streaming
DotNet Core is the new kid on the block which has people like us intrigued, with Angular 4 as being a standard front end it was pretty much given that I will try to learn these two.
It took me a better part of 12 hours just to get aĀ āHello Worldā like thing going and I am still not sure how to publish it as a website on any server.
Hopefully, this post will help few out there who are equally confused like me.
To begin with you will need these things installed on a windows machine
Visual Studio 2017 Community
Node.js
SQL Server Express(optional)
In your VS2017 just create a new DotNet core empty project
Now right click on the project and choose edit csproj file. Open your package manager run the following commands. Make sure you are inside the the correct folder, where the csproj file resides
Now open yourĀ StartUp.cs and make the follwoing changes
Next step is to add a WebAPI Controller class, for the demo program you may have the code written in any way you like, shown below is the snippet that I have used in my project.
public class AdminController : Controller { // GET: api/values [HttpGet] public JsonResult GetAllEmployee() { List obj = new List(); obj.Add("Sudeep"); obj.Add("Sanjeev"); obj.Add("Ashish"); return Json(obj); } }
Pretty self-explanatory as to what this class does.
Next step is extremely crucial, your experience may differ but please close the VS2017 then run the following command.
npm install @angular/cli
When this command has finished run the following command to createa new Angular application iat the same place where .csproj file is located
ng new MyAngularApp --skip-install
Once it is finished , go inside the new directory calledĀ MyAngularApp and copy -all the files and folder to the parent directoryĀ
C:\MyDotNetApp\MyDotNetApp\MyAngularApp copy everything from here toĀ Ā C:\MyDotNetApp\MyDotNetApp.
Open yourĀ .angular-cli.json and make the following changes
"outDir": "wwwroot",
Change app.component.ts to call the webapi
import { Component, OnInit } from '@angular/core';
import { Headers, Http, RequestOptions, URLSearchParams } from '@angular/http';
This part deals with another data binding method in Angular 4 calledĀ Property Binding, if you have missed the first part of this series then please do give it a read here. Property binding like string interpolation is one way too. It flows from the source class to theĀ target property.
Observe that we have added a simple variable listItemData which is of type object and has three properties. We will use this in our html code to bind to an element property. The variable has been initialized in the constructor.
Moving to our html code, we will bind the property value with our variable.
That is it we have successfully created one way data binding. If you execute this code you should see something like this.