Re: angular and rest questions
Re: angular and rest questions
- Subject: Re: angular and rest questions
- From: Ray Kiddy <email@hidden>
- Date: Fri, 15 Aug 2014 10:05:49 -0700
If you guys can put any of what you are doing up on a git repository,
please do. I would like to see it.
I am currently working on an AngularJS project. It does not have very
much need for data, so there is no WO. But I am definitely going to try
to be using this with WO in future work.
I will be putting stuff up as I can clear work-specific stuff out of it.
cheers - ray
On Fri, 15 Aug 2014 02:16:51 +0300
Farrukh Ijaz <email@hidden> wrote:
>
> On Aug 15, 2014, at 1:41 AM, Larry Mills-Gahl <email@hidden>
> wrote:
>
> > I’m not trying to build a single-page-app, but I am trying to take
> > advantage of the browser side manipulation of elements to make the
> > user interface more responsive without continually relying on
> > server side. I’m generally a control freak so I tend to favor
> > server-side rendering of elements, but considering the data is
> > already on the client, I don’t think I’m losing anything to let the
> > browser sort and filter the data.
> >
> > The simple test case I’m exploring is a list of reports that can be
> > many hundreds at a time. Normally, I would render a page of raw
> > rows on the server and ship it to the browser. If I use an ajax
> > rest request to get the data, I can render the page (without data)
> > on the server and ship it to the client, then the client makes an
> > ajax request for the data. That pattern gives the browser a
> > response more quickly and can provide feedback on the progress more
> > easily than an interim step like the long response page. Once the
> > json is loaded, the browser sorts and filters the list locally and
> > does not need to go back to the server.
>
> So far so good. Assuming your JSON looks like:
>
> $scope.reports = [
> {oid: ‘1', reportTitle: ’Report 1’},
> {oid: ‘2', reportTitle: ‘Report 2’},
> ...
> ];
>
> >
> > The next step is to select one of the reports and display the
> > detail page (where I’m using EO’s so that all the WO MVC goodness
> > can be used)
>
> Defined another action on your ERRestRouteController which will
> return Edit or Detail component you want to show for your report
> details. You can use something like:
>
> @Path(“/report/{report:Report}”)
> public WOActionResults reportDetail(@PathParam Report report) {
> // load your component, set appropriate binding and return...
> }
>
> In your ng-repeat component, use ng-click e.g.
>
> <ul>
> <li ng-repeat=“report in reports”><a
> ng-click=“reportDetails($index)”>{{report.reportTitle}}</a></li> </ul>
>
> The report details function will look like this.
>
> function reportDetails(i) {
> var oid = items[i].oid;
> window.location = ‘/report/‘ + oid;
> }
>
> I hope this will solve your problem or at least guide you in the
> right direction.
>
> Farrukh
>
> >
> > I am no angular expert and I may be thinking about this
> > incorrectly, but it seems that if I use the angular MVC pattern
> > with a read-only model, I will not get too screwed up. Angular has
> > directives that compete with some of the WOComponents (like the
> > WORepetition). I’m using the angular repetition component rather
> > than a WORepetition so that I can get the in-browser functions. I
> > will miss the easy data references to specific rows, but that
> > requires a server round trip so I just have to ask the server
> > explicitly for the object in the row rather than just referencing
> > the object bound to the “item” in the WORepetition.
> >
> > I’m not wed to angular and will take another look at Montage. I
> > think Ember is a good framework, but Angular seemed to be more
> > tolerant of mixed environments (where you can have an app context
> > that is a page fragment and even multiple app contexts in the same
> > page.) I’m not an Ember guy either, but the most success I’ve had
> > with Ember is when you can give yourself over to it and do the
> > entire app in Ember. I don’t have that luxury at the moment. It may
> > be my limited (mis-)understanding of Angular and Ember so I am
> > absolutely open for correction and suggestions.
> >
> >
> >
> > Larry Mills-Gahl
> > email@hidden
> >
> >
> > On Aug 14, 2014, at 4:36 AM, Philippe Rabier <email@hidden>
> > wrote:
> >
> >> Hi Laurence,
> >>
> >> It's just by curiosity: what do you try to achieve with angular?
> >> Prepare some part of a page on the server side the send back to
> >> angular (a mix of data + HTML + javascript)?
> >>
> >> 1 member of our team gave it a try but didn't like it very much.
> >> And personally I don't know Angular.
> >>
> >> We are redeveloping our back office app with MontageJS and ERRest
> >> for several months and we didn't have any problem.
> >>
> >> So I'm wondering if we missed something. We modified ERRest (and
> >> still need to optimize it) but nothing related to MontageJS (we
> >> added the capability to choose the set of attributes we need in
> >> the request, to return an EPOCH time for NSTimestamp, …).
> >>
> >> So if you can give more informations that could interest other I
> >> guess.
> >>
> >> Philippe
> >> ---------------------
> >> http://twitter.com/prabier
> >>
> >> Sent from my iPhone
> >>
> >> On 13 Aug 2014, at 23:35, Laurence Mills-Gahl <email@hidden>
> >> wrote:
> >>
> >>> Thanks Farrukh
> >>>
> >>> I'm still working on this in a limited test because angular and
> >>> wo are parallel universes and getting communications between the
> >>> universes is tricky. (I don't want to cause any problems with the
> >>> space-time continuum. ) My intention is to use wo on the server
> >>> side and angular for browser side interaction (filtering lists,
> >>> sorting, wizards...) I don't see any reason to do a server round
> >>> trip if I'm only filtering/selecting. It is easier to render
> >>> everything on the server and send it to the browser but user
> >>> experience (and expectations) is less tolerant of request
> >>> response time for data they already see in the browser. I'm
> >>> looking for a hybrid server client structure to satisfy my
> >>> control freak (on the server) and the rich (richer) user
> >>> experience. There are many fine client side frameworks and I'm
> >>> looking at angular and polymer as options that don't require a
> >>> complete takeover of the client side.
> >>>
> >>>
> >>> =====================
> >>> Larry Mills-Gahl
> >>>
> >>> On Aug 13, 2014, at 4:11 PM, Farrukh Ijaz
> >>> <email@hidden> wrote:
> >>>
> >>>> In my experience, WebObjects and AngularJS are two opposite
> >>>> dimensions. They do not go well together without some work
> >>>> arounds. I’m trying to build ERAngular framework which could
> >>>> help WO developers to achieve what angular provides still coding
> >>>> on the server side. E.g. a ERAngularModule which could provide
> >>>> server side access to $scope so you don’t need to write any
> >>>> javascript. This will take time… till then you can try following
> >>>> two options.
> >>>>
> >>>> 1. expose your component actions as URLs that can for $http
> >>>> service. 2. Use Apache Cordova and use jars that are used for
> >>>> Android plugins (they are java code) … this may be tricky but
> >>>> once a plugin is written, it’s piece of cake to communicate for
> >>>> posting data.
> >>>>
> >>>> I’ll try to find a better solution for you in the mean time :)
> >>>>
> >>>> Farrukh
> >>>>
> >>>> On Aug 13, 2014, at 10:09 PM, Larry Mills-Gahl
> >>>> <email@hidden> wrote:
> >>>>
> >>>>> I’ve got a project that I’m testing some angularjs with and am
> >>>>> encouraged by some of the things in the browser that are pretty
> >>>>> straight forward (loading and filtering json is pretty simple
> >>>>> and appears to play well with others)
> >>>>>
> >>>>> Since I’m using hg-repeat instead of WORepetition, I’m looking
> >>>>> for a good way to get the selected item from the angular
> >>>>> repetition. (I feel like there should be a better way than
> >>>>> hidden fields) Does anybody have any suggestions or javascript
> >>>>> mojo to bridge the wo/ng component communication?
> >>>>>
> >>>>> Yes, this would be easier if it were completely REST, but it’s
> >>>>> not (yet) so I’m trying to get the new, more interactive
> >>>>> (browser centric) components to work and play well with the old
> >>>>> server centric components.
> >>>>>
> >>>>> Larry Mills-Gahl
> >>>>> email@hidden
> >>>>>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden