How to extract parts of an address from a string?

Without key (key:value) We can’t get exact value. We can split the string, Make array and use. In array we have value with index and get value by index. But you must use key:value pair for dynamic data. Below example is not solution, some other scenario you can use like this.

var app = angular.module('exApp',[]);
app.controller('ctrl', function($scope){
var str1 = "69, 2nd Floor, J.P. & Devi Jambukeshwar Arcade, Miller’s Road,Bengaluru, Karnataka 560052, India";
$scope.str1 = str1.split(','); //console.log($scope.str1);
var str2 = "Shivaji Nagar,Bengaluru, Karnataka, India";
<script src=""></script>
<body ng-app="exApp" ng-controller="ctrl">
<div ng-repeat="str in str1 track by $index">{{str}}</div><br>{{str1}} <br><br> {{str1[0]}}, {{str1[1]}}, {{str1[2]}}, {{str1[3]}}, {{str1[4]}}, {{str1[5]}}, {{str1[6]}}

Browse More Popular Posts

Leave a Comment