PHP String Concatenation Example with demo 0

PHP String Concatenation Example

Today, We want to share with you PHP String Concatenation Example.In this post we will show you concatenate string in php foreach, hear for decision control structure in php we will give you demo and example for implement.In this post, we will learn about php string concatenation best practice with an example.

PHP String Concatenation Example

There are the Following The simple About PHP String Concatenation Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop php concatenate string and int, so the some major append two strings for this example is following below.

Concatenation of two strings in PHP

String Concatenation using dot operator

concatenate string in php foreach

<?php
$prefix_spg = "spg_";
$spg_group = array("jaydeep","krunal","dhaval","hardik");
foreach($spg_group as $key=>$value) {
$spg_name_with_prefix[] = $prefix_spg . $spg_group[$key];
}
print "<PRE>";
print_r($spg_name_with_prefix);
print "</PRE>";
?>

Example 1 : PHP append two strings

<?php
echo   'Welcome To Pakainfo.com -  one'.'Welcome To Pakainfo.com -  Two';
?>

Example 2: Decision control structure in php

<?php
$var1 = "Welcome To Pakainfo.com -  three";
$var2 = "Welcome To Pakainfo.com four";
echo $var1.$var2;
?>

PHP Concatenation of two strings

<?php 
  
//PHP First String 
$a = 'Hello'; 
  
//PHP Second String 
$b = 'World!'; 
  
//PHP Concatenation Of String 
$c = $a.$b; 
  
// print PHP Concatenate String 
echo " $c \n"; 
?> 

PHP Concatenation Operators

<?php
    $name="Jaydeep";
    $lastName="Gondaliya";
    echo $name." ".$lastName; // Outputs Jaydeep Gondaliya
    
    $a="Hello";
    $a .= " Jaydeep!";
    echo $a; // Outputs Hello Jaydeep!
?>

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP String Concatenation Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Validate Email Password Using jQuery 0

Validate Email Password Using jQuery

Today, We want to share with you Validate Email Password Using jQuery.In this post we will show you jquery email validation regex, hear for password and confirm password validation in javascript we will give you demo and example for implement.In this post, we will learn about password validation in javascript using regular expression with an example.

Validate Email Password Using jQuery

There are the Following The simple About Validate Email Password Using jQuery Full Information With Example and source code.

As I will cover this Post with live Working example to develop Password Validation using regular expressions, so the Email Validation Using jQuery Codes for this example is following below.

jQuery Email-Password Validation Checks

index.html

<html>
<head>
<title></title>
<link href="validate_style.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
function validate()
{
 var email=$("#email").val();
 var pass=$("#password").val();
 
 var email_regex=/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
 var setrules1=/([a-z].*[A-Z])|([A-Z].*[a-z])([0-9])+([!,%,&,@,#,$,^,*,?,_,~])/;
 var setrules2=/([0-9])/;
 var setrules3=/([!,%,&,@,#,$,^,*,?,_,~])/;

 if(email_regex.test(email)==false)
 {
  alert("Please Enter Correct Email");
  return false;	
 }
 else if(pass.length<8 || setrules1.test(pass)==false || setrules2.test(pass)==false || setrules3.test(pass)==false)
 {
  alert("Please Enter Strong Password");
  return false;
 }
 else
 {
  return true;
 }
}
</script>
</head>
<body>
<div id="wrapper">

<div id="user_form">
<p id="form_label">REGISTER FORM</p>
 <form method="post" onsubmit="return validate();">
  <input type="text" id="email" placeholder="Enter Email">>
  <input type="password" id="password" placeholder="*******">>
  <input type="submit" value="SUBMIT">
 </form>
<p id="pass_note">Password Must Be At Least 8 Digits Long And Contains One UpperCase, One LowerCase And One Special Character</p>
</div>

</div>
</body>
</html>

Step 2: validate_style.css
body
{
 margin:0 auto;
 padding:0px;
 text-align:center;
 width:100%;
 font-family: "Myriad Pro","Helvetica Neue",Helvetica,Arial,Sans-Serif;
 background-color:#ECF0F1;
}
#wrapper
{
 margin:0 auto;
 padding:0px;
 text-align:center;
 width:995px;
}
#wrapper h1
{
 margin-top:50px;
 font-size:45px;
 color:#626567;
}
#wrapper h1 p
{
 font-size:18px;
}
#user_form
{
 background-color:#B3B6B7;
 width:300px;
 margin-left:330px;
 padding:10px;
}
#user_form #form_label
{
 margin:0px;
 margin-bottom:20px;
 font-size:25px;
 font-weight:bold;
 color:#626567;
 text-decoration:underline;
}
#user_form input[type="text"],input[type="password"]
{
 width:250px;
 height:35px;
 padding:10px;
 margin-top:5px;
}
#user_form input[type="submit"]
{
 width:248px;
 height:35px;
 margin-top:5px;
 margin-left:-3px;
 background:none;
 border:1px solid white;
 color:white;
 font-weight:bold;
}
#user_form #pass_note
{
 color:#424242;
 font-size:14px;
 font-style:italic;
}

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Validate Email Password Using jQuery.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

PHP Check duplicated value in array Example 0

PHP Check duplicated value in array

Today, We want to share with you PHP Check duplicated value in array.In this post we will show you php array find duplicate keys, hear for php check if array has duplicate values we will give you demo and example for implement.In this post, we will learn about avoid duplicate values in foreach php with an example.

PHP Check duplicated value in array

There are the Following The simple About PHP Check duplicated value in array Full Information With Example and source code.

As I will cover this Post with live Working example to develop php find duplicates in an array, so the php remove duplicates from string for this example is following below.

Example 1 : PHP array_unique() Function

PHP Remove duplicate values from an array:

<?php
$a=array("a"=>"jaydeep","b"=>"gondaliya","c"=>"jaydeep");
print_r(array_unique($a));
?>

output
Array ( [a] => jaydeep [b] => gondaliya )

Example 2: PHP Remove duplicate values

How to remove duplicate values from an array in PHP

array_unique() and types

<?php
$input = array(4, "4", "3", 4, 3, "3");
$result = array_unique($input);
var_dump($result);
?>

output

array(2) {
  [0] => int(4)
  [2] => string(1) "3"
}

Example 3 : Check If PHP Array Contains Duplicates

Custom Helper for Check If PHP Array Contains Duplicates

function arrayContainsDuplicate($array)  
{  
      return count($array) != count(array_unique($array));    
}  

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP Check duplicated value in array.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

VueJS Check duplicated value in array 0

VueJS Check duplicated value in array

Today, We want to share with you VueJS Check duplicated value in array.In this post we will show you vue duplicate keys detected, hear for Rendering array remove duplicate values in vuejs we will give you demo and example for implement.In this post, we will learn about avoid duplicate values in the output of v-for loop in vuejs with an example.

VueJS Check duplicated value in array

There are the Following The simple About VueJS Check duplicated value in array Full Information With Example and source code.

As I will cover this Post with live Working example to develop vue js find duplicate objects in array, so the vue check for duplicate entries for this example is following below.

Include Vuejs CDN

https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.24/vue.min.js

HTML Part

<form id="chat">
	<ul id='message'>
		<li v-for="msg in messages">{{msg}}</li>
	</ul>

	<input v-model="message">
	<button v-on:click="add">add</button>
</form>

JavaScript Part

new Vue({
	el:"#chat",
	data:{
		messages:[],
		message:''
	},
	methods:{
		add:function(e){
			e.preventDefault();
			this.messages.push(this.message);
		}
	}
});

vuejs remove duplicates from array

v-for loop in vuejs

methods: {
        myFilter: function (val, idx, arr) {
          for(var i = 0; i < idx; i++) {
            if(arr[i].name === val.name) {
              return false;
            }
          }
          return true;
        } 
      }

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about VueJS Check duplicated value in array.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Angular4 routing removes hash problem 0

Angular4 routing removes hash problem

Angular4 routing removes hash problem

In this Post We Will Explain About is Angular4 routing removes hash problem With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to angular4 router fragment Example

In this post we will show you Best way to implement Angular 4 hash removes Example, hear for angular 4 remove hash from url with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Change Angular 4 to use PathLocationStrategy set

@NgModule({
  .....
  providers: [
    {provide: LocationStrategy, useClass: PathLocationStrategy} // This simple angular data line is optional as default set to LocationStrategy is PathLocationStrategy
  ]
})

base Href in index.html

Change the angular base Href in index.htmlAngular4 will handle simple all routes data post base Href


//For example



index.html

At the backend any server, you must render the simple main file like as a index.html file for any data request coming with below some source code and pattern

"/app/**" - Render index.html for any  page same request coming using "/app/**" pattern





  
  <title>Wel-come to Pakainfo.com - free Download source code</title>
  
  
    Loading(Pakainfo.com)....
    
    
  


Angular 4 hash Remove Example

imports: [
    ...//some source code
    RouterModule.forRoot(routes, { useHash: true })  //simple angular4 remove second argument
]

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is angular4 router hash And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

Angularjs Check duplicated value in array 0

Angularjs Check duplicated value in array

Today, We want to share with you Angularjs Check duplicated value in array.In this post we will show you AngularJS find duplicate objects in array, hear for Removing Duplicate Entries from ng-repeat in AngularJS we will give you demo and example for implement.In this post, we will learn about Calculate If Duplicates Exist In An Array Using AngularJS with an example.

Angularjs Check duplicated value in array

There are the Following The simple About Angularjs Check duplicated value in array Full Information With Example and source code.

As I will cover this Post with live Working example to develop underscore js find duplicates in array, so the AngularJS check for duplicate entries for this example is following below.

Implementing our Test Controller

var homeApp = angular.module('homeApp', []);

homeApp.controller('homeController' , function ($scope) {
    $scope.list = [
        { 'name' : "Mobile" },
        { 'name' : "Mobile" },
        { 'name' : "Mobile" },
        { 'name' : "ipod" },
        { 'name' : "Computer" },
        { 'name' : "Computer" },
        { 'name' : "Computer" },
        { 'name' : "iPhone" },
        { 'name' : "Laptop" },
        { 'name' : "Laptop" },
        { 'name' : "Laptop" },
        { 'name' : "iPeed" }
        ];
});

<html ng-app="homeApp">
<head>
    <title>AngularJS Removing Duplicates from ng-repeat</title>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
</head>
<body ng-controller="homeController">
    
    <ul>
        <li ng-repeat="item in list">{{item.name}}</li>
    </ul>
    
    <script src="script.js"></script>
</body>
</html>

Filtering Out Duplicates

var homeApp = angular.module('homeApp', []);

homeApp.filter('unique', function() {
   return function(collection, keyname) {

      var output = [], 
          keys = [];
      
      angular.forEach(collection, function(item) {
          var key = item[keyname];
          if(keys.indexOf(key) === -1) {
              keys.push(key); 
              output.push(item);
          }
      });
      return output;
   };
});

homeApp.controller('homeController' , function ($scope) {
    $scope.list = [
        { 'name' : "Mobile" },
        { 'name' : "Mobile" },
        { 'name' : "Mobile" },
        { 'name' : "ipod" },
        { 'name' : "Computer" },
        { 'name' : "Computer" },
        { 'name' : "Computer" },
        { 'name' : "iPhone" },
        { 'name' : "Laptop" },
        { 'name' : "Laptop" },
        { 'name' : "Laptop" },
        { 'name' : "iPeed" }
        ];
});

Modifying our Index File

<li ng-repeat="product in list | unique : 'name'">{{product.name}}</li>

Filtering by Nested Properties
<li ng-repeat="product in list | unique:'name.nested_property'>{{product.name}}</li>

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Angularjs Check duplicated value in array.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

jQuery Check duplicated value in array 0

jQuery Check duplicated value in array

Today, We want to share with you jQuery Check duplicated value in array.In this post we will show you Jquery check if array contains duplicate string, hear for jQuery array Find duplicate values in a array we will give you demo and example for implement.In this post, we will learn about Calculate If Duplicates Exist In An Array Using Jquery with an example.

jQuery Check duplicated value in array

There are the Following The simple About jQuery Check duplicated value in array Full Information With Example and source code.

As I will cover this Post with live Working example to develop jQuery check duplicate values in inputs, so the Check duplicated value in array for this example is following below.

Example 1: Jquery check if array contains duplicate string

var reportRecipients = ['PAKAINFO', 'ARITY', 'PAKAINFO', 'GONDALIYA', 'JAYDEEP', 'ARITY', 'PQR'];
var memberArrData = reportRecipients.sort(); 

var reportCheckDuplicate = [];
for (var i = 0; i < memberArrData.length - 1; i++) {
    if (memberArrData[i + 1] == memberArrData[i]) {
        reportCheckDuplicate.push(memberArrData[i]);
    }
}

Example 2: check duplicate values using jQuery

jQuery to remove duplicate items from array

HTML Part

<h3>Before data removing deuplicate jQuery array elements </h3>
<div id="mydata"></div>
<hr/>
<h3> After data removing deuplicate jQuery array elements </h3>

<div id="checkDuplicate"></div>

js Part
$(document).ready(function () {
    var arr = [10, 19, 22, 36, 50, 74, 10, 22];
    $('#mydata').html(arr.join("<hr>"));
    arr = $.unique(arr);
    $('#checkDuplicate').html(arr.sort().join("<hr />"));
});

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about jQuery Check duplicated value in array.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Convert JavaScript Array to JSON Example 0

Convert JavaScript Array to JSON

Today, We want to share with you Convert JavaScript Array to JSON.In this post we will show you Converting JSON text to JavaScript Object, hear for convert array into json object in javascript we will give you demo and example for implement.In this post, we will learn about convert multidimensional array to json javascript with an example.

Convert JavaScript Array to JSON

There are the Following The simple About Convert JavaScript Array to JSON Full Information With Example and source code.

As I will cover this Post with live Working example to develop converting circular structure to json, so the convert array to json for this example is following below.

Javascript array to JSON Example

In simple JavaScript, We can use simple function Like JSON.stringify to convert an array or data values into a JSON formatted string.

var output = {}
output[0] = "a";
output[1] = "b";
output[2] = "c";

console.log( JSON.stringify(output) );

output

{
	"0":"a",
	"1":"b",
	"2":"c"
}

Example 1. jQuery Ajax Request

Some times, We need to any time convert the JavaScript some values into JSON before calling an AJAX POST request. For example :

$(document).ready(function () {

    $("#find-form").submit(function (event) {

        event.preventDefault();

		//simple array
        var find = {}
		find["membernm"] = $("#membernm").val();
		find["address"] = $("#address").val();

		$.ajax({
			type: "POST",
			contentType: "application/json",
			url: "/api/find",
			data: JSON.stringify(find), // convert simple An array to JSON
			dataType: 'json',
			cache: false,
			timeout: 100000,
			success: function (data) {
				console.log("SUCCESS : ", data);

			},
			error: function (e) {

				console.log("ERROR : ", e);

			}
		});

    });

});

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Convert JavaScript Array to JSON.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

jQuery check if an element is exists in dom 0

jQuery check if an element is exists

Today, We want to share with you jQuery check if an element is exists.In this post we will show you jquery check if class exists within div, hear for Check if HTML element exists jquery we will give you demo and example for implement.In this post, we will learn about jquery check if dynamic element exists with an example.

jQuery check if an element is exists

There are the Following The simple About jQuery check class and id if an element is exists Full Information With Example and source code.

As I will cover this Post with live Working example to develop jquery check if div exists by class, so the jquery check if id exists for this example is following below.

Check if Element Exists Using Javascript or jQuery

For jQuery example,

if($('#content1').length){
	alert("Content1 exists");
}else{
	alert("Content1 does not exists");
}

jQuery length example

<html>
<head>
<title>pakainfo.com - Check if element exists in jQuery</title>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>

</head>

<body>

<h1>jQuery check if an element exists</h1>

<script type="text/javascript">

  $(document).ready(function(){

    $("#buttonContent1").click(function () {
		
	if($('#content1').length){
		alert("Content1 exists");
	}else{
		alert("Content1 does not exists");
	}
			
    });

    $("#buttonContent2").click(function () {
		
	if($('#content2').length){
		alert("Content2 exists");
	}else{
		alert("Content2 does not exists");
	}
			
    });
	
  });
</script>
</head><body>

<div id="content1">
	<b>This is Content element which has an ide of "content1"</b>
</div>

<br/>
<br/>
<br/>

<input type='button' value='content1 exists?' id='buttonContent1'>
<input type='button' value='content2 exists?' id='buttonContent2'>

</body>
</html>

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about jQuery check if an element is exists.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Vuejs autocomplete search with typeahead js 0

Vuejs autocomplete search with typeahead js

Today, We want to share with you Vuejs autocomplete search with typeahead.js.In this post we will show you Vue AutoComplete TextBox Component, hear for Popular Vue autocomplete Component we will give you demo and example for implement.In this post, we will learn about Building an Autocomplete Component with Vue.js with an example.

Vuejs autocomplete search with typeahead.js

There are the Following The simple About Vuejs autocomplete search with typeahead.js Full Information With Example and source code.

As I will cover this Post with live Working example to develop Autocomplete Field using Vue.js, so the bootstrap-vue autocomplete for this example is following below.

HTML Part

<div id="app">
  <h3>form auto complete</h3>
  <div class="d-flex">
    <div class="d-flex-lang">
      <h4>Single Select</h4>
      <form-autocomplete
        v-model="programmingLangA"
        :options="countries"
        placeholder="please select programmingLang"
      ></form-autocomplete>
      <p>
        Selected programmingLang : <br/>
        lid: {{programmingLangA.lid}}  <br/>
        title: {{programmingLangA.title}}
      </p>
    </div>
    <div class="d-flex-lang">
      <h4>Multi Select</h4>
      <form-autocomplete
        is-multiple
        v-model="multiLanguageA"
        :options="countries"
        placeholder="please select programmingLang"
      ></form-autocomplete>
      <div>
        Selected programmingLang : <br/>
        <p v-for="(v, k) in multiLanguageA" :key="k">
          lid: {{v.lid}} - title: {{v.title}}
        </p>
      </div>
    </div>
    <!-- With Scope Slot -->
    <div class="d-flex-lang">
      <h4>Single Select - with Scope Slot</h4>
      <form-autocomplete
        v-model="programmingLangB"
        :options="countries"
        placeholder="please select programmingLang"
      >
        <template slot-scope="row"><span :class="`flag-icon flag-icon-${toLowerCase(row.lang.lid)}`"></span> {{row.lang.title}}</template>
        <template slot="selected" slot-scope="row"><span :class="`flag-icon flag-icon-${toLowerCase(row.lang.lid)}`"></span> {{row.lang.title}}</template>
      </form-autocomplete>
      <p>
        Selected programmingLang : <br/>
        lid: {{programmingLangB.lid}}  <br/>
        title: {{programmingLangB.title}}
      </p>
    </div>
    <div class="d-flex-lang">
      <h4>Multi Select - with Scope Slot</h4>
      <form-autocomplete
        is-multiple
        v-model="multiLanguageB"
        :options="countries"
        placeholder="please select programmingLang"
      >
        <template slot-scope="row"><span :class="`flag-icon flag-icon-${toLowerCase(row.lang.lid)}`"></span> {{row.lang.title}}</template>
        <template slot="selected" slot-scope="row"><span :class="`flag-icon flag-icon-${toLowerCase(row.lang.lid)}`"></span> {{row.lang.title}}</template>
      </form-autocomplete>
      <div>
        Selected programmingLang : <br/>
        <p v-for="(v, k) in multiLanguageB" :key="k">
          lid: {{v.lid}} - title: {{v.title}}
        </p>
      </div>
    </div>
    <!-- Default value -->
    <div class="d-flex-lang">
      <h4>Single Select - Default value</h4>
      <form-autocomplete
        v-model="programmingLangC"
        :options="countries"
        placeholder="please select programmingLang"
      >
        <template slot-scope="row"><span :class="`flag-icon flag-icon-${toLowerCase(row.lang.lid)}`"></span> {{row.lang.title}}</template>
        <template slot="selected" slot-scope="row"><span :class="`flag-icon flag-icon-${toLowerCase(row.lang.lid)}`"></span> {{row.lang.title}}</template>
      </form-autocomplete>
      <p>
        Selected programmingLang : <br/>
        lid: {{programmingLangC.lid}}  <br/>
        title: {{programmingLangC.title}}
      </p>
    </div>
    <div class="d-flex-lang">
      <h4>Multi Select - Default Value</h4>
      <form-autocomplete
        is-multiple
        v-model="multiLanguageC"
        :options="countries"
        placeholder="please select programmingLang"
      >
        <template slot-scope="row"><span :class="`flag-icon flag-icon-${toLowerCase(row.lang.lid)}`"></span> {{row.lang.title}}</template>
        <template slot="selected" slot-scope="row"><span :class="`flag-icon flag-icon-${toLowerCase(row.lang.lid)}`"></span> {{row.lang.title}}</template>
      </form-autocomplete>
      <div>
        Selected programmingLang : <br/>
        <p v-for="(v, k) in multiLanguageC" :key="k">
          lid: {{v.lid}} - title: {{v.title}}
        </p>
      </div>
    </div>
  </div>
</div>

CSS Part

.d-flex {
  display: flex;
  flex-wrap: wrap;
}
.d-flex-lang {
  width: 300px;
  padding: 10px;
  border: 1px solid #eaeaea;
  margin: 0 20px 20px 0;
}
.form-autocomplete {
  padding: 10px;
  background: #eaeaea;
}

ul {
  width: 200px;
  padding-left: 0;
}
ul > li {
  cursor: pointer;
  list-style: none;
  padding: 5px;
  margin-bottom: 5px;
  border: 1px solid white;
  background: #dedede;
}
ul > li:hover {
  background: #313131;
  color: white;
}
ul > li.disabled,
ul > li.disabled:hover {
  background: #eaeaea;
  color: #a7a7a7;
  cursor: inherit;
}
ul > li.disabled .flag-icon {
  opacity: 0.5;
}

.langs-selected {
  margin-top: 20px;
}
.lang-selected {
  border-radius: 5px;
  display: inline-block;
  padding: 5px;
  background: #7b8fdc;
  color: white;
  margin: 0 5px 10px 0;
}

Js Part

const countries = [
  { lid: 'AU', title: 'Laravel' },
  { lid: 'ID', title: 'Angularjs' },
  { lid: 'KR', title: 'PHP' },
  { lid: 'NZ', title: 'Magento' },
];

Vue.component('form-autocomplete', {
  template: 
    `<div class="form-autocomplete">
      <div v-if="!isMultiple">
        <input v-if="!value.lid" v-model="textSearch" type="text" :placeholder="placeholder" @focus="showOptions"/>
        <div class="langs-selected">
          <div class="lang-selected" v-if="value.lid">
            <slot name="selected" :lang="value">{{value.lid}} - {{value.title}}</slot> <button @click="clearItem">remove</button>
          </div>
        </div>
        <ul class="options" v-show="isShow">
          <li v-for="lang in filteredOptions" @click="selectItem(lang)">
            <slot :lang="lang">{{lang.title}}</slot>
          </li>
          <li v-if="filteredOptions.length===0">Item not found</li>
        </ul>
      </div>
      <div v-if="isMultiple">
        <input v-model="textSearch" type="text" :placeholder="placeholder" @focus="showOptions"/>
        <div class="langs-selected">
          <div class="lang-selected" v-for="(v, k) in value">
            <slot name="selected" :lang="v">{{v.lid}} - {{v.title}}</slot> <button @click="removeItem(k)">remove</button>
          </div>
        </div>
        <ul class="options" v-show="isShow">
          <li v-for="lang in filteredOptions" :class="{'disabled': inSelectedItems(lang.lid)}" @click="addItem(lang)">
            <slot :lang="lang">{{lang.title}}</slot>
          </li>
          <li v-if="filteredOptions.length===0">Item not found</li>
        </ul>
      </div>
    </div>`
  ,
  props: {
    isMultiple: {
      type: Boolean,
      default: false,
    },
    placeholder: {
      type: String,
      default: '',
    },
    options: {
      type: Array,
      default() {
        return [];
      },
    },
    value: {
      type: [Object, Array],
      default() {
        return {
          lid: undefined,
          title: undefined,
        };
      },
    },
  },
  data() {
    return {
      textSearch: '',
      isShow: false,
    };
  },
  computed: {
    filteredOptions() {
      return this.options.filter(val => val.title.toLowerCase().includes(this.textSearch.toLowerCase()));
    },
    selectedItems() {
      if (this.isMultiple) {
        return this.value.map(v => v.lid);
      }
      return [];
    },
  },
  methods: {
    inSelectedItems(lid) {
      return this.selectedItems.includes(lid);
    },
    showOptions() {
      this.isShow = true;
    },
    selectItem(lang) {
      this.textSearch = '';
      this.isShow = false;
      // this.$emit('update:lang', lang);
      this.$emit('input', lang);
      this.$emit('onSelectItem', lang);
    },
    clearItem() {
      this.textSearch = '';
      // this.$emit('update:lang', {
      //   id: undefined,
      //   title: undefined,
      // });
      this.$emit('input', {
        id: undefined,
        title: undefined,
      });
      this.$emit('onClearItem');
    },
    addItem(lang) {
      if (!this.inSelectedItems(lang.lid)) {
        this.textSearch = '';
        this.isShow = false;
        const langs = JSON.parse(JSON.stringify(this.value));
        langs.push(lang);
        // this.$emit('update:lang', langs);
        this.$emit('input', langs);
        this.$emit('onAddItem', langs);
      }
    },
    removeItem(index) {
      this.textSearch = '';
      const langs = JSON.parse(JSON.stringify(this.value));
      langs.splice(index, 1);
      // this.$emit('update:lang', langs);
      this.$emit('input', langs);
      this.$emit('onRemoveItem', langs);
    },
  },
});
new Vue({
  el: '#app',
  data() {
    return {
      programmingLangA: {
        lid: undefined,
        title: undefined,
      },
      programmingLangB: {
        lid: undefined,
        title: undefined,
      },
      programmingLangC: {
        lid: 'ID',
        title: 'Angularjs',
      },
      multiLanguageA: [],
      multiLanguageB: [],
      multiLanguageC: [
        { lid: 'ID', title: 'Angularjs' },
        { lid: 'AU', title: 'Laravel' },
      ],
    };
  },
  methods: {
    toLowerCase(text) {
      return text.toLowerCase();
    },
  },
});

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Vuejs autocomplete search with typeahead.js.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.