Skip to content

add angular docs#97

Open
mazaheriMahdi wants to merge 15 commits intoStar-Academy:masterfrom
mazaheriMahdi:feature/angular-docs
Open

add angular docs#97
mazaheriMahdi wants to merge 15 commits intoStar-Academy:masterfrom
mazaheriMahdi:feature/angular-docs

Conversation

@mazaheriMahdi
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread docs/frontend/phase10-angular.md Outdated
Mahdi mazaheri added 3 commits July 6, 2024 17:55
@dkhorasanizadeh
Copy link
Copy Markdown
Member

بهتره که تو یک سری از قسمت های مهم از کارآموز بخوایم با چیزهایی که تو اون قسمت یاد گرفته یک کار کوچیک انجام بده تا بازخورد بگیره. (این بجز تمرین نهایی اون فاز و پروژه هستش)

Comment thread docs/frontend/05-angular.md Outdated
@@ -0,0 +1,239 @@
---
title: Angular
description: When I was a kid, my mom used to just throw me into a pile of broken glass!
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

متن Description تغییر کنه. یک متن فارسی باشه که توضیح میده تو اون داک چی می‌خوایم بگیم و اگر کمی طنز باشه هم مشکلی نداره.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread docs/frontend/05-angular.md Outdated
Comment thread docs/frontend/05-angular.md Outdated
# Angular

## مقدمه‌ای بر Angular
[Angular](https://angular.io/) یک فریمورک و پلتفرم برای ساخت برنامه‌های تک‌صفحه‌ای (SPA یا single page application) با استفاده از HTML و TypeScript است. این فریمورک توسط گوگل توسعه داده شده و نگهداری می‌شود و ابزارها و معماری محکمی را برای ساخت برنامه‌های قابل گسترش ارائه می‌دهد.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

به طور کلی کلمات انگلیسی به صورت
Title case
نوشته بشن و مثل کانونشن داک‌های ستاره برای خوانایی بیشتر مارکداون، در یک خط مجزا قرار بگیرن.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread docs/frontend/05-angular.md
Comment thread docs/frontend/05-angular.md
Comment thread docs/frontend/05-angular.md Outdated
<h1>{{ title }}</h1>
```

در این مثال، `title` یک property از کامپوننت است که مقدار آن در قالب نمایش داده می‌شود. لازم به ذکر است هر تغییر در مقدار `title` به طور خودکار توسط Angular تشخیص داده شده و در نتیجه قالب به صورت خودکار بروز می‌شود. (البته این در صورتی است که در change detection تغییری انجام نشده باشد که در بخش‌های آینده از آن صحبت خواهیم کرد)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

نامگذاری یکپارچه نیست. تمپلیت یا قالب؟

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

مفهوم change detection در کجا توضیح داده شده؟

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

در این مثال، `title` یک property از کامپوننت است که مقدار آن در قالب نمایش داده می‌شود. لازم به ذکر است هر تغییر در مقدار `title` به طور خودکار توسط Angular تشخیص داده شده و در نتیجه قالب به صورت خودکار بروز می‌شود. (البته این در صورتی است که در change detection تغییری انجام نشده باشد که در بخش‌های آینده از آن صحبت خواهیم کرد)

### Property Binding

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

درباره اینکه
property
چی هستش یک یاداوری کوچک بشه بهتره.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

این به نظرم نیاز نیست خیلی واضخه

Comment thread docs/frontend/05-angular.md Outdated

### Event Binding

در Angular، می‌توانید eventها را در قالب مدیریت کنید و به متدهای کامپوننت متصل کنید. این کار با استفاده از `( )` انجام می‌شود.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

در اینجا درباره مفهوم ایونت بیشتر توضیح داده بشه.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


### Two way binding

- [Demystifying Angular Two Way Binding](https://www.youtube.com/watch?v=vkmwbZV-ob8)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

یک توضیحی بدیم که این چیه و چرا بهش نیاز داریم و بعد طرف رو بفرستیم یاد بگیره.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


### angular routing
‌ابزار قدرتمند انگولار برای جابه‌جایی بین صفحات مختلف استفاده می‌شود.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

مثل کامنت قبل نیازه که لزوم روتینگ رو توجیه کنیم.

Comment thread docs/frontend/05-angular.md Outdated

کامپوننت‌ها بلوک‌های ساختمانی اصلی برنامه‌های Angular هستند. هر کامپوننت شامل یک کلاس TypeScript، یک قالب HTML و یک فایل سبک CSS است. کامپوننت‌ها به شما امکان می‌دهند تا بخش‌های مختلف برنامه را به صورت مجزا توسعه داده و مدیریت کنید.

برای ساخت کامپوننت از `@Component` استفاده می‌کنیم. در این decorator مشخصه `selector` مشخص می‌کند که این کامپوننت با چه تگی در HTML استفاده خواهد شد، `template` قالب HTML کامپوننت را تعریف می‌کند، و `styles` استایل‌های CSS مربوط به کامپوننت را مشخص می‌کند.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

به جای @component بنویس دیکوریتور component که به صورت @component نمایش داده میشود

Comment thread docs/frontend/05-angular.md Outdated
ng g c hello-world
```

این دستور در هر دایرکتوری اجرا شود به صورت خودکار دایرکتوری جدید شامل فایل HTML، CSS، TypeScript و فایل تست تشکیل می‌دهد. (برای نام گذاری componentها از قرارداد `name.component.ts` و برای تست از `name.component.spec.ts` استفاده می‌شود)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

و فایل تست

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

تستو نگفتی ساخته میشه

Comment thread docs/frontend/05-angular.md Outdated
users: string[] = [];
newUser: string = '';

constructor(private userService: UserService) {}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

داخل توضیح بگو تو کانستراکتور اینجکتش میکنیم

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

گفتیم

Comment thread docs/frontend/05-angular.md Outdated

**مثال:**

اگر بخواهیم یک تاریخ را به فرمت تاریخ شمسی تبدیل کنیم، از پایپ `DatePipe` استفاده می‌کنیم:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

date نیست تایمه

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

چی ؟

اگر بخواهیم یک تاریخ را به فرمت تاریخ شمسی تبدیل کنیم، از پایپ `DatePipe` استفاده می‌کنیم:

```html
<p>تاریخ امروز: {{ today | date:'hh:mm:ss' }}</p>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

زمان

Comment thread docs/frontend/05-angular.md Outdated
<p>تاریخ امروز: {{ today | date:'hh:mm:ss' }}</p>
```

در این مثال، `today` یک متغیر در کامپوننت Angular است که تاریخ فعلی را نگهداری می‌کند. `date` یک پایپ است که تاریخ را به فرمت "hh:mm:ss" تبدیل می‌کند و نمایش می‌دهد.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

تایم بشه همه اینا اینجا سوتی دادیم

Comment thread docs/frontend/05-angular.md Outdated
}

```
در این پایپ،‌ متد transform تاریخ را به عنوان ورودی دریافت کرده و به فرمت دریافتی تبدیل کرده و آن را برمی‌گرداند.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

در این متد تاریخ رو میگیریم و زمان رو استخراج میکنیم و نمایش میدیم

mazaheriMahdi and others added 10 commits July 9, 2024 15:57
Co-authored-by: Danial Khorasanizadeh <36936076+dkhorasanizadeh@users.noreply.github.com>
Co-authored-by: Danial Khorasanizadeh <36936076+dkhorasanizadeh@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants