We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to integrate EJ Controls in GoLang?

What is GoLang?

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. We can integrate Syncfusion EJ controls with GoLang. Here, we have loaded the packages where this sample figures out the JS Views.

 

How to Install GoLang?

Refer this installation guide to install GoLang. Ensure whether GoLang is installed in your machine in this location (C:\Go). Please refer the below screenshot.

 

 

Steps to create the GoLang project with EJ Control?

We can use command prompt to create the project.

 

Step 1: Create an empty directory to maintain the GoLang project named as “gosample” by using the below command.

 

                                   $ mkdir gosample

 

Step 2: Create a file named as main.go and load the following packages.

[main.go]

 

 

  In the above code snippet,

  • We have imported the following two packages.
  • html/template

This package is part of the Go standard library. This is used to keep the HTML in a separate file, allowing us to change the layout of our edit page without modifying the underlying Go code.

  • net/http

This is used to build the web application.

 

  • We have used “renderTemplate” method to process the html file.
  • We can use “HandleFunc” method to specify the handler(e.g.-sync).
  • We have used “ListenAndServe” method to specify the port number (e.g.-8085) in which the gosample project will be hosted.

Step 3: Create the html file (edit.html) within gosample project and refer the required scripts, css file to render EJ controls. We have passed this html file to renderTemplate method.

[edit.html]

 

 

Step 4: You can use the below commands to compile and run the application

 

      $ go build main.go - This command is used to build the project.

 

            $ wiki - This command is used to run the project.

 

Step 5: Open the browser and give the html file(main.html) as a localhost using handler (sync) and port number (8085) specified in the main.go file.

e.g. http://localhost:8085/sync/edit.html

 

Article ID: Published Date: Last Revised Date: Platform: Control:
7974 08/31/2017 09/04/2017 JavaScript General
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon