Saturday, February 5, 2022

Angular Js Utility

1.  ng-init in Angular Js

@if (Request.QueryString["a"] != null)

{

           <input type="hidden" ng-init="p.user_type='@Request.QueryString["a"]'" />

}

                                        

2. ng-model

<input type="text" id="txtname" ng-model="p.name" class="form-control" placeholder="Enter User Address" maxlength="100" />


3.  ng-click

<input type="button" id="btnsearch" ng-click="getEmployeeList()" class="btn btn-sm btn-success" value="Search" />


4.  ng-change

<select class="form-control" ng-change="getEmployeeList()" ng-model="p.user_type" ng-init="p.user_type=''">

         <option value="">All</option>

         <option value="1">Paid</option>

         <option value="0">UnPaid</option>

</select>


5. Pass value in angular function 


 $scope.p = {};

        var status = null;


        $scope.getIncomeList = function () {

            $('.loader').show();

            if (status == null) {

                status = "2";

            }

            $http.get('/Admin/getReward_Income', $scope.p).then(function (res) {

                $('.loader').hide();

                $scope.getIncome = res.data.IncomeList;

            });

        };




No comments:

Post a Comment

Linq Expression syntax for where condtion in linq

(Expression<Func<T, bool>> filter)