# NgxMitaa
This library provides an Angular service to get all locations
## Installation
```bash
npm install ngx-mitaa
```
Or if you use yarn
```bash
yarn add ngx-mitaa
```
## Usage
Import the service in your component where you want to use it
```typescript
import { NgxMitaaService } from 'ngx-mitaa';
```
Inject the service in your component's constructor or using inject function
```typescript
constructor(private ngxMitaaService: NgxMitaaService) {}
// or
const ngxMitaaService = inject(NgxMitaaService);
```
```typescript
// Get all locations
const locations = this.ngxMitaaService.getLocations();
```
This will return an array of objects with the following structure;
```typescript
[
{
continent: 'Africa',
countries: [
{
country: 'Tanzania',
regions: [
{
region: 'Dar es Salaam',
districts: [
{
district: 'Ilala Cbd',
wards: [
{
ward: 'Kivukoni',
streets: ['Kivukoni', 'Sea View'],
},
{
ward: 'Upanga Mashariki',
streets: ['Kitonga', 'Kibasila'],
},
],
},
],
},
],
},
],
},
];
```
```typescript
// Get all continents
const continents = this.ngxMitaaService.getContinents();
```
This will return an array of strings with the following structure;
```typescript
[
'Africa',
'Antarctica',
'Asia',
'Australia',
'Europe',
'North America',
'South America',
];
```
```typescript
// Get all countries by continent(defaults to Africa)
const countries = this.ngxMitaaService.getCountries('Africa');
```
This will return an array of strings with the following structure;
```typescript
["Tanzania", "Burundi", "Kenya", , "Rwanda", "South Sudan", "Uganda" ...];
```
```typescript
// Get all regions by country(default to Tanzania) and continent(defaults to Africa)
const regions = this.ngxMitaaService.getRegions('Tanzania', 'Africa');
```
This will return an array of strings with the following structure;
```typescript
[
"Dar es Salaam",
"Dodoma",
"Iringa",
"Kagera",
"Kigoma",
"Kilimanjaro",
"Lindi",
"Manyara",
"Mara",
"Mbeya",
...
];
```
```typescript
// Get all districts by …