Showing posts with label Ajax. Show all posts
Showing posts with label Ajax. Show all posts

Monday, January 8, 2018

Working with Creating Custom Component in Angular JS

Here is the way by which we can create your own Custom Component. To create custom component you have already installed necessary stuffs and your basic application is working with default layouts. Also, you have selected your default working folder in Visual Studio Code.

(1) Under your created application, find src, under that create a folder with name of your component like "product"

(2) in product folder, add files .html & .ts like product.html & product.ts
- in product.html file, your html code will reside & in product.ts your code/logic will reside

(3) to bind any property with your newly added component build product.ts with below
import {Component} from '@angular/core';
@Component({
    selector:"product",
    templateUrl:"./product.html"
})
export class Product{
title: string = "Hello World!";
}
- for selector property, it will be reside under your default "app.component.html" file which will hold your product html data within this tag
- templateUrl, is the path of your html which will render once application get loaded

(4) for your html, you want to bind your "title" property like below

{{title}}
- {{}} is the directive used to bind/display your ts object value and it will display there

(5) Upto this step we are done with our custom component, but to render/display this to your application, it will be render with following steps
- go to "app.component.html" file, create tag with name "product"
- go to "app.module.ts", import your component with
import { ProductListComponent } from './products/product';
add class name of your component, in our case it is "Product". so add "Product" in "declarations" under @NgModule

Performing above steps will add your custom component to your application and this will show your "Hello World!". Also, the way here is manual by adding files and folders but you can also create same thing with a command for Step-(1) & Step-(2).

Angular Component


Wednesday, January 3, 2018

Working with NEW Angular

Here is some list of links to work with NEW Angular JS. Links are for the what is angular, examples, download editor+node js+visual studio code, & basics of type script.

(1) Angular

(2) Get Started

(3) Download Quick Start Example

(4) Download NodeJS

(5) Angular CLI

(6) List of Angular Modules/Library Packages

(7) Type Script Overview

(8) Visual Studio Code

(9) Bootstrap Link

(10) Mozilla Developer Events


Thursday, May 7, 2015

Working with Export to PDF in Kendo Grid

Here is some link to work with export to PDF in kendo grid

(A) PDF Export Demo: Export to PDF demo and documentation link 
(1) Grid / Export to PDF

(2) Walkthrough of the Grid Features and Behavior

(B) Kendo UI Export Options with Customizations: Export to PDF functionality in two different way you want to manipulate
(1) Kendo UI Drawing API Export functionality - Document Export

(2) Kendo UI PDF Export customizations - Page Layout

(C) Kendo Grid Export to PDF: Export to PDF with launcher which lets user to ask user if we export then it will ask user with open/save dialog
(1) Kendo UI Grid Export to Excel / PDF not working on IE9

(2) Kendo Grid Configuration for Export

Monday, August 18, 2014

Working with AngularJS with Get/Post calls

Here is some code which will show how can we use get/post calls when working with AngularJS. For these code i assume that you are aware of some basic knowledge of AngularJS code and syntaxes. Also, for this examples i used WCF service as data source which returns expected results as i want for my use so you can change code or source of service as per your need.

(1) Get With Single Value : This function returns single string value.
HTML :  





AngularJS : 

var sample = function ($scope, $http) {
        $http({
            url: '/MyService.svc/DoWorkWithString'
        }).success(function (data) {
            $scope.stringResult = data.DoWorkWithStringResult;
        });
    };

(2) Get With List of values : This function returns list of Name & Count which are processed at UI and displayed to view.
HTML : 







AngularJS : 
var ListController = function($scope, $http) {
        var resultPromise = $http.get("MyService.svc/ListItems");
        resultPromise.success(function(data) {
            $scope.ListItems = data.ListItemsResult;
        });
    };

For the post operation, both function simply returns string value which could be any success/error message that we can pass to UI after completion of any
operation on posting.
(3) Post with single parameter : posts one valueHTML : 




Angular JS :
function FrmController($scope, $http) {
$scope.errors = [];
$scope.msgs = [];
$scope.Click = function () {
$scope.errors.splice(0, $scope.errors.length); // remove all error messages
$scope.msgs.splice(0, $scope.msgs.length);
$http({ method: 'POST', url: 'MyService.svc/ListTest', data: JSON.stringify($scope.idTest) }).success(function (data) {
                if (data != '') {
                    $scope.msgs.push(data);
                } else {
                    $scope.errors.push(data);
                }
            });
};

(4) Post with two parameter
HTML : 

Angular JS :
function FrmController($scope, $http) {
$scope.errors = [];
$scope.msgs = [];
$scope.Click = function () {
$scope.errors.splice(0, $scope.errors.length); // remove all error messages
$scope.msgs.splice(0, $scope.msgs.length);
$http({ method: 'POST', url: 'MyService.svc/ListTestTwo', data: JSON.stringify({"param1":"value1","param2":"value2"}) }).success (function (data) {
                if (data != '') {
                    $scope.msgs.push(data);
                } else {
                    $scope.errors.push(data);
                }
            });
};

So, That's it for AngularJS with Get/Post calls.

Monday, August 4, 2014

Error : Service data not get refresh in IE8 from Client Side

I face problem of Data not refresh from client side when we are working with IE. I found this problem while i am working with IE8 and above.

Problem is like, in my MVC Single Page Application, when we are fetching any data from client side for first time it will get data perfectly but subsequent call for same data or some back and forth to some other location give me previous unchanged data which are cached. But, after a bit of googling following line of code works for me and resolved my problem.



This line of code i put in "_layout.cshtml" header section and it works for me and then after it gives me refreshed data view.


The above line of code works fine for me and resolved my problem.

Tuesday, June 24, 2014

Error : 405 Method Not Allowed for PUT

Recently i came across with a problem where PUT is not working for me and throwing error of "405 Method Not Allowed for PUT".

Following line of code i found working for me.
- Open your web.config file
- Go To "system.webServer" Tag
- Add runAllManagedModulesForAllRequests="true" in modules clause
- Put remove name="WebDAVModule" between modules tag
- After adding this lines, your config will look like following..
This change works for me. Also, There are some useful links for this as well shown below.
(1) 405 method not allowed web api

(2) Web API on IIS 8.0 – 405 Method Not Allowed for PUT

(3) Web API Put Request generates an Http 405 Method Not Allowed error
                      

Monday, January 25, 2010

Working with jQuery


Here is some links that shows how to working with jQuery.
- jQuery Introduction
(1) An Introduction to jQuery - Part 1: The Client Side


(2) Downloading jQuery - jQuery JavaScript Library

- Popup window

Calling Server side function using Ajax

Here is some links that shows working with call server side function using Ajax.


AutoComplete using Ajax

Here is some links that shows working with autocomplete using Ajax.