Angular 4 Popup Window Example

Angular 4 Popup Window

In this Angular modal tutorial we will be creating Angular 4 popup window modal by creating a button which will trigger the popup window function.

First open CMD and run:

npm install ng2-opd-popup


import {PopupModule} from 'ng2-opd-popup'

Continue reading

Git Quick Start – Learn How to Install GIT and More

Git and Github Installation

Github and Git Quick Start
Install Git  and use it with Github

Git is a source version control which can help you to keep history for all your code or files, source version control software helps programmers to have access to code while keep record for all versions and give the ability to them to work in parallel.

Install Git on Windows/Linux and Mac:
Go to this link to download the right version for your operating system, installing Git on Windows is straight forward as it's a simple wizard, on Linux you can use 'yum install git' or 'apt-get install git'  depends on the Linux flavor you are using. Continue reading

How to Create Components in Angular 4

How to Create Components in Angular 4 (the easy way)

If you have created already your first Angular project, then from the command line you can run from your project folder:

ng generate component dotsway-component.component
or use command shortcut:
ng g c dotsway-component.component

This will auto generate your component files which they consist of (it will be automatically generated in /src/app/your-component-name/):

*.css "Stylesheet"
*.ts "TypeScript"
*.spec.ts "used for unit testing"

Also the ng while creating the new component will add 'import' to the main app module with the new component name to be included in your project application.

I mentioned above that this is the easy way to create a component, the other way is simply creating a folder with your component name inside the /usr/app/component-name and then create all the files manually and write the code.

Now how to use our new component in the html ? simply add the new component name tag which in our above example is dotsway-component.component to the main app.component.html like below example:
And now the tags will be replaced by the html in dotsway-component.component.html

What Are Components in Angular 4

What Are Components in Angular 4

Components are the main magic feature which Angular has, imagine it that way, you have a website or web application which is a single page application, it starts with a single page which has the main component \ but from there you can have each part of this site loaded from different component which includes different (script and html).

Components live in /src/app, components are structures by thre main parts

Angular 4 Components
#1 Import section is where you import the needed component from angular, so some components will have dozens of imports needed as a dependency fo used code.
#2 The decorator as in that figure it starts with @component which that is the part that defines it as a component, then there are several properties for that component, in that figure example the selector is showing the name of the component while templateUrl and styleUrls showing both the html and css which wll be connected to that component.
In that section you can add other properties too which we will be discussing in later articles.

#3 This is the main class which holds all the functions and code needed for that component.

Click here to learn how to create Angular 4 components.


Create Your First GOLang 'Hello World!' Program

First GO Hello World

Please visit this link if you need to learn how to install GOLang on Linux machine.

Now let us create your own first go project, go project consists of main three folder (bin, src and pkg), create them in your desired folder:

cd /home/dotsway/
mkdir -p ~/first_go_project/{bin,src,pkg}

Now add your project folder to the Linux environment if not there yet by adding below to Linux environment.

export GOPATH="$HOME/first_go_project"
export GOBIN="$GOPATH/bin"

Now run source ~/.bashrc to reload it and then type echo $GOPATH to confirm that folder is in the right place:

[root@hmharddcweb01 meliks]# go version
go version go1.8.1 linux/amd64
[root@hmharddcweb01 meliks]# go env
[root@hmharddcweb01 meliks]# go help

Writing Your First GOLang Hello World!

First be sure that you installed go on you machine by running 'go version' and have similar output:

go version go1.8.1 linux/amd64

Make a folder and file in your projects folder, to know where is your project folders you can run below command:
echo $GOPATH, below example shows that if GOPATH is /root/first_go_project.

mkdir -p /root/first_go_project/src/hello
vi /root/first_go_project/src/hello/hello.go

Type the following code inside hello.go

package main
import "fmt"
func main() {
fmt.Printf("Hello from, you have created your first GoLang in Linux\n")

Below commands will do both compile and run the code:

go install $GOPATH/src/hello/hello.go
Hello from, you have created your first GoLang in Linux


Install GOLang on Linux

GOLang Programming Language
What is GOLang?

It's a programming language which started at 2007 by Google, the main initiative was to have a language based on C++ but with modern syntax.

What is GOLang Good For ?

I have seen people doing some servers' background jobs with it, also a lot of popular open source apps were created by GoLang like Docker for example, still i don't see it as all around language like Java for example.

Popular Open Source Applications Done by GOLang:

Docker, Kubernetes,Etcs, Desi, Flynn, Lime, Revel, InfluxDB and load more of other open sources are built by golang

How to install go on Linux

Go to any of your desired folder to download golang package and replace the url after wget by the latest version you find here. ""

In below example i am using --no-check-certificate to ignore any invalid SSL certificate since i am sure of the source.

cd /home/dotsway/
wget --no-check-certificate

Extract the tarball:

tar xvfz go1.8.1.linux-amd64.tar.gz
cp -R /home/dotsway/go /usr/local/

Now you need add 'go' to your Linux environment, click here to know how to add path to Linux environment.