I realize this is a basic question, but how does synchronization between the client and server work with Angular? I understand the concept of data-binding once you've retrieved the data to a data-structure on the client-side, thus causing that data to update the view in the DOM, but what triggers a client-side update when your server-side data changes? Do you need to poll a REST service to check for changes? Does the…
AngularJS is not a server-side framework and therefore it is agnostic on that question. You can do it however you like and you can even create directives that keep the client model synchronized with server-side, but it doesn't come out of the box.
Angular 2.0
71–80 of 169 posts
Re: Angular 2.0
#72AngularJS has a J2EE mindset. Where libraries grow to become as hard to learn as programming languages themselves. It does not make semantic sense to me anymore. Here is an example from the site: Length (float): {{length}} This is not a valid float number! How semantic is ng-show="form.length.$error.float? smart-float sounds like C++. If programming languages worked like this, we wouldn't have built many apps. The pr…
This is true. AngularJS is much better than what we had before, it is kind of large and monolithic. The cycle probably goes thusly: Large monolithic framework comes and shows everyone a new way of doing things (Angular/Django). People think it is too large and monolithic, so make microframeworks (Flask/Whatever comes after Angular). The next step will be a kind of happy medium.
Re: Angular 2.0
#73All I really need are client-side templates and awesome DOM binding. What's the current best options?
I'm planning to use it in my next project but haven't yet. It seems to fit the bill nicely.
Re: Angular 2.0
#74Earlier quoted context omitted.
This is true. AngularJS is much better than what we had before, it is kind of large and monolithic. The cycle probably goes thusly: Large monolithic framework comes and shows everyone a new way of doing things (Angular/Django). People think it is too large and monolithic, so make microframeworks (Flask/Whatever comes after Angular). The next step will be a kind of happy medium.
Except that Backbone.js, a micro-framework if there ever was one, exploded in popularity long before most people had even heard of AngularJS.
I predict that the next winner will leverage web components and do the one thing that makes that paradigm better.
Re: Angular 2.0
#75Earlier quoted context omitted.
> DI enables testability, ..... the learning curve of DI doesn't justify the gains in testability Dependency Injection is a redundant, useless pattern in dynamic languages; especially when it comes to testability. In test.js: //paymentService may be an instance or a class services.paymentService = mockPaymentService; .... //use paymentService in your tests here. The above over-simplified example satisfies most test c…
With DI you can ensure you're not accessing anything that's globally defined. While you can mock out global objects and methods on global objects, it becomes far less clear what the ramifications of doing so becomes when your app becomes large and complicated. With DI, you have all the dependencies clearly defined for the function you're concerned about. Beyond testing, DI makes it much easier to swap in different im…
Parse and Firebase example:
//someservice.js
...
//works as long as both retain the same interface.
provider = new FirebaseProvider; //new ParseProvider()
//add: just using an if condition, the old fashioned way.
getProvider: function() {
if (config.provider === 'parse')
return ParseProvider()
else
return FirebaseProvider()
Why is writing configuration cleaner than doing the above? That thought process is carried over from projects with lengthy build time.Re: Angular 2.0
#76Earlier quoted context omitted.
React solves all the problems in the world with their nestable but still autonomous components approach. It dispenses controllers -- and automatically give control to the component which deserves it --, it dispenses templates, and automatically gives the power to make the entire app in modular small pieces of HTML, it dispenses models, because models are already embedded in the components in which data is rendered. R…
I'm curious what happens when you want to share models across components. In angular.js you would use services to do this, but what's the analog in React?
Re: Angular 2.0
#77Earlier quoted context omitted.
I only looked superficially at React, so maybe I got something wrong, but the HTML/XML intermingled with Javascript seems extremely off-putting to me, akin to ASP/JSP/PHP.
The thing that sold me on React was this statement: "Most people make the mistake that the DOM is a place you put things." The DOM is what the user sees. That's all. With React, you have a virtual DOM that can hold everything, not just what the user sees. It's a pure data structure, and can be manipulated as such. Because that DOM is a pure data structure, React can figure out for you what parts have changed, and re-…
Re: Angular 2.0
#78Earlier quoted context omitted.
This is true. AngularJS is much better than what we had before, it is kind of large and monolithic. The cycle probably goes thusly: Large monolithic framework comes and shows everyone a new way of doing things (Angular/Django). People think it is too large and monolithic, so make microframeworks (Flask/Whatever comes after Angular). The next step will be a kind of happy medium.
Except that Backbone.js, a micro-framework if there ever was one, exploded in popularity long before most people had even heard of AngularJS.
(That's why things like rivet and epoxy exist; because backbone doesn't do it right)
Re: Angular 2.0
#79Earlier quoted context omitted.
React solves all the problems in the world with their nestable but still autonomous components approach. It dispenses controllers -- and automatically give control to the component which deserves it --, it dispenses templates, and automatically gives the power to make the entire app in modular small pieces of HTML, it dispenses models, because models are already embedded in the components in which data is rendered. R…
I'm curious what happens when you want to share models across components. In angular.js you would use services to do this, but what's the analog in React?
Passing data to separate components without a shared parent is outside of what React is trying to accomplish but I've handled it before by passing a Backbone model to the separate components as props.
Re: Angular 2.0
#80Earlier quoted context omitted.
AngularJS is not a server-side framework and therefore it is agnostic on that question. You can do it however you like and you can even create directives that keep the client model synchronized with server-side, but it doesn't come out of the box.
So if you want to poll a service periodically, you can do that ... or if you want to use a websocket and just leave a pipe open to refresh your client-side model ... you can do that too? Got it. Thanks.