Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completed BASE #512

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"src/assets"
],
"styles": [
"@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss"
],
"scripts": []
Expand Down Expand Up @@ -90,6 +91,7 @@
"src/assets"
],
"styles": [
"@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss"
],
"scripts": []
Expand Down
952 changes: 950 additions & 2 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@
"private": true,
"dependencies": {
"@angular/animations": "^17.3.0",
"@angular/cdk": "^17.3.10",
"@angular/common": "^17.3.0",
"@angular/compiler": "^17.3.0",
"@angular/core": "^17.3.0",
"@angular/forms": "^17.3.0",
"@angular/material": "^17.3.10",
"@angular/platform-browser": "^17.3.0",
"@angular/platform-browser-dynamic": "^17.3.0",
"@angular/router": "^17.3.0",
"@ngrx/effects": "^17.2.0",
"@ngrx/store": "^17.2.0",
"@ngrx/store-devtools": "^17.2.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.3"
Expand All @@ -35,4 +40,4 @@
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.4.2"
}
}
}
72 changes: 72 additions & 0 deletions src/Task-8.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
const getDatasFunc = async () => {
let res = await fetch("https://jsonplaceholder.typicode.com/users");

if (res.ok) {
let jsonData = await res.json();
//1

const gData = jsonData.map((e) => {
let jData = {
id: e.id,
username: e.username

}
return jData
})

//3
const filtered = jsonData.filter(e => e.id == 9)
//4
function getCityByName(val, usrArr) {
return usrArr.find((u) => u.address.city === val) || null;
}
const getByCName = getUserByName("Lebsackbury", jsonData)

//5
const get5el = users.slice(0, 5)

//6
jsonData.toReversed().map(e => console.log(e))
//7
const usrCount = jsonData.length



jsonData.map((e) => {

//2
console.log(e.email)
//3
if (e.id === 9) {
//console.log(e)
}
//4
if (e.address.city.includes("Lebsackbury")) {
//console.log(e)
}
//8
if (e.address.city.includes(".com")) {
//console.log(e)
}
//9
if (e.username.length > 7) {
//console.log(e)
}
//10
const isLowerCase = (string) => /^[a-z]*$/.test(string)
if (isLowerCase(e.name) == true) {
//console.log(e.name)
}



console.log(e)
})

} else {
alert("Ошибка HTTP: " + res.status);
}


}
getDatasFunc()
1 change: 1 addition & 0 deletions src/app/admin/admin.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>admin works!</p>
Empty file.
23 changes: 23 additions & 0 deletions src/app/admin/admin.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { AdminComponent } from './admin.component';

describe('AdminComponent', () => {
let component: AdminComponent;
let fixture: ComponentFixture<AdminComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AdminComponent]
})
.compileComponents();

fixture = TestBed.createComponent(AdminComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
12 changes: 12 additions & 0 deletions src/app/admin/admin.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-admin',
standalone: true,
imports: [],
templateUrl: './admin.component.html',
styleUrl: './admin.component.scss'
})
export class AdminComponent {

}
Loading