Learning Custom Directives In AngularJS – A Practical Approach


AngularJS Introduction

Introduction

In my previous article of AngularJS, I tried to explain the basics of AngularJS to get you started. In this article, I will explain the core concept of AngularJSl  i.e., directives. First, we will see what directives are and then I will try to explain how to build the custom directives, using some examples, which I have prepared. Moreover, in this article, I will be focusing more on the practical examples and the code rather than confusing you by writing tough definitions and heavy terms.

Continue reading “Learning Custom Directives In AngularJS – A Practical Approach”

Javascript Alert in C#


Code:

/// 

/// A JavaScript alert 

/// 

public static class Alert

{

    /// 

    /// Shows a client-side JavaScript alert in the browser.
    /// 


    /// The message to appear in the alert.

    public static void Show(string message)

    {

        // Cleans the message to allow single quotation marks

        string cleanMessage = message.Replace(“‘”“\\'”);
        string script = string.Format(“$(document).ready(function(){alert(‘{0}’);});”, cleanMessage);

        
// Gets the executing web page

        Page page = HttpContext.Current.CurrentHandler as Page;

        
// Checks if the handler is a Page and that the script isn’t all ready on the Page

        if (page != null && !page.ClientScript.IsClientScriptBlockRegistered(“alert”))

        {

            page.ClientScript.RegisterClientScriptBlock(typeof(Alert), “alert”, script);

        }

    }

}