Using angular 4 for making just ajax call [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to use Angular 4 for doing small operation like just making ajax call. Note: I know, I can use plain jquery to do this... blah... blah...
Question:
What Angular 4 Nuget Packages I need to Install for doing small operations like just making ajax call. Any example will help.
Technologies I am working with: Asp.net MVC, .Net Core, C-Sharp

This would be an inappropriate use of Angular. Angular is a client-side technology whose primary purpose is to provide a single-page application (or SPA) user interface for a Web application.
The idea is that the entire application runs on the client and does not require going back to the server to navigate between the pages of the application. The only time an Angular application needs to hit the server is to get data or to lazy load more of the application.
It makes no sense to use Angular within an MVC application to retrieve data.

Related

Use Angular with an existing Asp.Net Website [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am working on a project where we already have an existing website built using Asp.Net. We are planning to add some new pages and update some existing one.
I am planning to develop those new pages in Angular 5 with Webpack. We can not convert the whole website into Angular due to budget constraint but ultimate goal is to convert in completely in Angular 5.
Have anyone worked on such a hybrid app in recent future?
Can someone please throw some light on it, whether it is workable and If there is any performance impact due to mixing up the technologies.
Yes I'm working in a similar situation, and it's definitely possible. An .NET page (MVC?) can return an Angular SPA and take control of the UI flow from that point on.
Say you want to start by creating a "User Profile" page in Angular. When the user navigates to that page in your standard MVC site, it should return the page with the Angular application loaded (as a javascript script reference). From there on, the Angular app can handle further redirects and logic.
It does make some things complicated, but it's usually not feasible to port things in one go. This approach has allowed us to move over to Angular, 1 page at a time.
We at a large company have done exactly that. It is very simple. Using angular-cli create a new project
ng new my-project
and copy the contents into the root of your existing ASP.NET solution. You will now need to use
ng build --watch
instead of
ng serve
and copy the script includes from /dist/index.html into your aspx or cshtml file.

Create App with Ionic2-Angular2 front and ASP.NET core Back? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
how can I create app with Ionic2-Angular2 front-end and ASP.NET core Back-end? in same server. Also I what about multi-platform application.
Yes, you can. In ASP.NET you'll create a web API, that will be consumed from angular code. Here is how you create a web API: https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-web-api
Angular, more precisely the JavaScript which will be generated, does not "know" what kind of back end is used. There just will be an URL and the method how to access it. Your communication will probably embrace HTTP GETs and POSTs.
As long as the resource is accessible with one of the methods,
it does not matter if it is
a static file (post would not make sense in this case)
a PHP script
or ASP.NET Backend
or something else.

c#: should we have two different endpoint for clients i.e. UI and Service or create common endpoint for all cleints? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
We have two layers from where all clients enter the application:
UI Layer: We have MVC, Webforms, JS code here.
We call C# MVC controller in this project from JS. We use this for MSite/Desk clients. This returns back HTML to the clients.
Service Layer: This is Web API project. Android, IOS clients call this to get back JSON.
Both have different URLs,
Its becoming tricky to have common validation for these two different entrypoints?
Should we make a common entrypoint i.e. UI calling service layer to get data? How can we do this? Or is there some other way to solve this?
You can use your WEB API endpont as common endpont. All your client application should call endpoint only.
Your MVC application should also call the same web api which mobile apps are calling

How to use AngularJS on a WebServices project [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm currently working (as a school project, nothing real) on a REST WebServices to handle a little chat system. The WebServices tier is done, but now I have to add an administration panel to allow users to manage their databases (conversations registered, message, etc).
I would like to know how to implement this using Angular JS.
Should I add the features needed on my WebServices, or should I create some new controller in the ASP.NET project just for this ?
Thanks in advance for your answer.
Firstly, your AngularJS project supposed to be front-end system which contains UI & logic code to make calls to web service and your webservice project (I don't know whether you choose WCF/Web API/ASMX or anything) supposed to be the back-end system which will expose some HTTP endpoints (GET/POST/PUT/DELETE) for your front-end system to call. I would suggest you to separate these two projects so that you can have clearer view about how two of them communicate with each other.
For the second part of your question, now you want to use AngularJS to call your webservice. The most common way is $http (https://docs.angularjs.org/api/ng/service/$http). Just put the code inside your event handler (button clicked or submitted) and it should be working.
$http.post('/someUrl', data, config).then(successCallback, errorCallback);
Hope it helps
You would create an html form that uses ng-model on the text fields to represent your back end models. Next you will need a controller to send those models via a service that will interact with your rest web services to persist your data. I'm actually working on several applications like this currently but they have a node.js based back end instead of .Net but the format for sending and retrieving data is json.

Configure WebClient to speed up download [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
What I am doing
I am trying to migrate Classic Asp app to ASP.NET MVC. Classic App was written for 15 years. There are no chance to write new project and migrate all code at one moment. Business app must work 24/7.
What solutions I have found
I did not find any good solution. One advice I have found starts with words "I feel your pain, bro". Business can not give such human resources for global refactoring. So the only way I found is to write some kind of proxy using WebClient.
Architecture
I have server with IIS that hosts Classic ASP app. I will add MVC app near it. Every request received by server will be managed by MVC project. If there is action that request asks - MVC app will work as normal. Render view, return to client. If there is no such action Controller will call Classic ASP by using HandleUnknownAction method.
So it will do some work by processing url and cookies and in the end call Classic Asp app by WebClient.DownloadString(). The return string (HTML response) it will embed as content to the page (Headers, Footers are in MVC Layout). Need to mention - project is not highlighted but near it.
So I can migrate old code by small pieces. Action by action with no impact on application. Just by creating action methods in MVC.
Requirements
Response time will grow significantly.
There are no alternatives.
Question
I want to know every possible chance to speed up such web app. Maybe by tweaking WebClient configuration or so. Are there any settings to do this? Maybe some advices to manage webclient pool? I do not need to make cross server requests - does this open any abilities? Maybe this is the place for async calls? Or reorganize server structure?
Thanks for any advice!

Categories

Resources