A small angular JS application, calls a WCF service

If you are new to angular js application, then this demonstration would help you a lot.

In below demo, i have used some angular js directive.
DirectiveName
{
width:30%;
}

ng-app By adding this, we declare the scope of the angular js application. This means the application starts here.

ng-controller This handles the application.
ng-model This binds the input values to the application data.
ng-disableed This is used to enable/disable a html control.
ng-click This handles the click event.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>My Angular demo</title>
</head>
<body>
    <div ng-app="LoginApp" ng-controller="LoginCtrl">
        <input type="text" ng-model="user.firstName" />
        <input type="text" ng-model="user.lastName" />
        <input type="submit" ng-click="Login()" value="Login" ng-disabled="!user.firstName && !user.lastName" />
        {{status}}
        {{!user.firstName}}

    </div>
    {{status}}
    <script src="js/angular.min.js"></script>
    <script>
        var app = angular.module("LoginApp", []);
        app.controller("LoginCtrl", function ($scope, $http) {
            $scope.Login = function () {
                if ($scope.user.firstName != "" && $scope.user.lastName != "") {
                    $http.get("Login.svc/IsUserExist?firstName=" + $scope.user.firstName + "&lastName=" + $scope.user.lastName)
                        .success(function (result) {
                            $scope.status = result.d;
                            if (result.d) {
                                alert("The user is exist in server");
                            }
                        });

                }

            }
        });
    </script>
</body>
</html>

2014 in review

The WordPress.com stats helper monkeys prepared a 2014 annual report for this blog.

Here’s an excerpt:

A New York City subway train holds 1,200 people. This blog was viewed about 5,900 times in 2014. If it were a NYC subway train, it would take about 5 trips to carry that many people.

Click here to see the complete report.

Different types of WCF Contracts

By this article, we will get to know all contracts available in WCF
The contracts will let the client know regarding the functionality, the service provide. In WCF we need one interface and we can add all the Contracts inside the interface.

There are 4 types of contracts:

  1. ServiceContract
  2. OperationContract
  3. DataContract
  4. DataMember

You can get the ServiceContract and OperationContract WCF attribute classes in the System.ServiceModel namespace.
You can get the DataContract and DataMember classes are in the System.Runtime.Serialization namespace.
These classes are used to define the details of the contract that your service will have with calling clients.

ServiceContract:By adding the ServiceContract attribute class in the interface, we are telling the that you are a WCF service

OperationContract: If we need to expose a method to the client. Then We need to add this contrat to that particular method.

DataContract:The DataContract attribute class is added to mark that type (classes,
enumerations, or structures) serializable.
DataMember:The DataMember attribute class is used to mark individual fields
and properties that you want to serialize. You use this class with the DataContract class.