نظرات مطالب
inject$ در AngularJs
به صورت کلی با استفاده از watch$ میتوان تمامی تغییراتی را که به خواص ViewModel اعمال میشوند مشاهده کرد.
تعریف کلی آن به صورت زیر است:
»watchExpression : میتوان نام خاصیت مورد نظر در ViewModel یا یک تابع را که قصد مشاهده تغییرات آن را داریم تعیین کنیم.
»Listener : با تغییر در مقدار watchExpression اگر مقدار قبلی این عبارت با مقدار فعلی آن برابر نباشد این تابع فراخوانی میشود.
» objectEquality : به صورت پیش فرض Angular مقادیر مورد نظر برای تغییرات را فقط از نظر Reference Equal بودن چک میکند. اگر بخواهیم که Angular به صورت عمقی و درختی مقادیر ابجکتها را بررسی کند مقدار این پارامتر باید true شود.
تعریف کلی آن به صورت زیر است:
$watch(watchExpression, listener, objectEquality)
»Listener : با تغییر در مقدار watchExpression اگر مقدار قبلی این عبارت با مقدار فعلی آن برابر نباشد این تابع فراخوانی میشود.
» objectEquality : به صورت پیش فرض Angular مقادیر مورد نظر برای تغییرات را فقط از نظر Reference Equal بودن چک میکند. اگر بخواهیم که Angular به صورت عمقی و درختی مقادیر ابجکتها را بررسی کند مقدار این پارامتر باید true شود.
در فریم ورک Angular هر زمان که عمل مقید سازی خواص ViewModel به عناصر DOM
انجام میگیرد در واقع یک نمونه از watch$ به لیستی به نام watch list $
اضافه میشود. دقت کنید که صرفا تعریف در محدوده کنترلر کافی نیست بلکه باید خاصیت مورد نظر حتما مقید شود. برای مثال
app.controller('MainCtrl', function($scope) { $scope.foo = "Foo"; $scope.world = "World"; });
در View نیز
Hello, {{ World }}
در کنترلر بالا دو خاصیت تعریف شده است، در حالی که در View فقط یک خاصیت مقید شده است. درنتیجه فقط یک watch$ به لیست مورد نظر اضافه شده است.
و به عنوان نکته آخر، در Angular نسخه 1.1.4 تابعی به نام watchCollection اضافه شده است که برای ردیابی تغییرات یک مجموعه مورد استفاده قرار میگیرد.
یک مثال در این موردو به عنوان نکته آخر، در Angular نسخه 1.1.4 تابعی به نام watchCollection اضافه شده است که برای ردیابی تغییرات یک مجموعه مورد استفاده قرار میگیرد.
In short, domain events help you to express, explicitly, the domain rules, based in the ubiquitous language provided by the domain experts. Domain events also enable a better separation of concerns among classes within the same domain.
It's important to ensure that, just like a database transaction, either all the operations related to a domain event finish successfully or none of them do.
Domain events are similar to messaging-style events, with one important difference. With real messaging, message queuing, message brokers, or a service bus using AMQP, a message is always sent asynchronously and communicated across processes and machines. This is useful for integrating multiple Bounded Contexts, microservices, or even different applications. However, with domain events, you want to raise an event from the domain operation you are currently running, but you want any side effects to occur within the same domain.
The domain events and their side effects (the actions triggered afterwards that are managed by event handlers) should occur almost immediately, usually in-process, and within the same domain. Thus, domain events could be synchronous or asynchronous. Integration events, however, should always be asynchronous.
اشتراکها
آیندهی Windows Phone
The latest round of layoffs in Microsoft’s Windows Phone business— 1,850 jobs will be cut, according to an announcement earlier this week—seems to signal the final death gasp of a segment of the company’s business that has long struggled. Windows phones currently make up less than one percent of smartphones sold worldwide.
اشتراکها
task ها در سی شارپ
اشتراکها
پروژه فروشگاهی angular , node js
اشتراکها