JavaScript for Line of Business Applications
596.1K views | +0 today
Follow
JavaScript for Line of Business Applications
Keeping track of current JavaScript Frameworks that help design your clientside Business Logic Layers.
Curated by Jan Hesse
Beam to my Inbox:
Your new post is loading...
Your new post is loading...

Popular Tags - Filter using the Funnel

Current selected tags: 'asp.net', 'directive'. Clear
Scoop.it!

Posting Data & AngularJS Custom Directives in an ASP.NET MVC application

Posting Data & AngularJS Custom Directives in an ASP.NET MVC application | JavaScript for Line of Business Applications | Scoop.it

In this article, we will explore how to use AngularJS to Post Data and use AngularJS Custom Directives in an ASP.NET MVC application.

So to post data, we need to simply call the save function on our resource instance. However there is a slight gotcha. The $resource object expects all the functions to post to the same URL. In MVC terms, this means posting to the same action method with different HttpGet/HttpPost/HttpPut etc attributes.

In our code, currently the HomeController uses GetTweets method to get the Data. Now Posting to a URL called GetTweets is semantically icky. So let’s update the Controller method to be called justTweetSo we will do GET, POST, PUT etc. requests to the url /Home/Tweet.

No comment yet.
Scoop.it!

Using Custom Directive in AngularJS to create reusable JavaScript components for your ASP.NET MVC app

Using Custom Directive in AngularJS to create reusable JavaScript components for your ASP.NET MVC app | JavaScript for Line of Business Applications | Scoop.it

Today we’ll see how to use a feature called Directives in Angular JS. Directives allow you to encapsulate custom behavior in an HTML element, attribute, classes and even comments. For example, the ng-app attribute that we use to define the scope of our Angular App is in fact a Directive, because there are no HTML5 attributes by that name! It’s Angular who interprets the attribute at runtime. 

Apart from helping add custom attributes, directives can also be used to create the server side equivalent of ‘tag-libraries’ on the client. Those familiar with WebForms or JSP development will remember you could create server side components with custom Tags like <asp:GridView>…</asp:GridView> where the GridView rendering logic was encapsulated in a server component. Well, Directives allow you build such components, but on the client. 

No comment yet.