Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
My first week of development using <angular/>
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  10 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dobrica Pavlinusic  
View profile  
 More options Nov 6 2010, 10:56 am
From: Dobrica Pavlinusic <dpav...@gmail.com>
Date: Sat, 6 Nov 2010 07:56:06 -0700 (PDT)
Local: Sat, Nov 6 2010 10:56 am
Subject: My first week of development using <angular/>
Thanks to great help I received at this list, I was basically able to
accomplish my goal to write simple conference submission application
within
a week of first git clone of angular source from github.

I think it might be useful to summarize my experience here, especially
for
people who are still wondering if angular is worth a try. Executive
summary
is: yes it is!

If you want to take a look at source first, jump over to:

https://github.com/dpavlin/angular-mojolicious/blob/master/templates/...

or if you want to click on something first hop over to

http://webpac2.rot13.org:3000/conference/Work

(which is temporary url which will be available until next reboot or
so)

I wanted to have simple form to submit data about papers for
conference.
Basically, one work per submission, but with possibility to group a
bunch of
works in symposium (single topic which have additional data).

My first idea for implementation (probably because of my relational
brain)
was to create two controllers, one for Work and another for Symposium
and
store Symposium.id within Work to make a connection. I tried different
approaches, including JavaScript global variables, putting state
inside
service and probably few more, but I couldn’t figure out how to share
state between controllers.

In the process, I figured out that your data object doesn’t really
exist
until it’s passed all ng:required checks, which actually pushed me
towards
another idea: use single controller and re-use symposium data in all
work
coping it from first work to second and so on. This provided better
overall
user experience :-)

In the end, I added another $resource to store Symposiums, but this is
really convenience (mostly because my REST back-end is basically hash
in
memory and I didn’t want to implement back-end queries yet). This
proved
to be easy, but does look a bit callback-ish.

I would love some feedback how other people are implementing master/
detail
form pattern in which they fetch data from two $resources and want to
keep
some kind of link between them (my solution basically replicates data
twice).

In the process, I also learned to pull code from github often. I had
week
old version which I couldn’t make working, and new version came out. I
noticed that I was hitting bugs which where already fixed on github.
Kudos
to speedy release cycle.

I have few things for which I’m not sure that I took a right route:

Since I store all authors in array, to have authors form appear on
page load
I use master data with empty strings which is required but invalid
value.

I’m using ng:eval to provide form _changes flag so I can show and hide
save button depending on form state. I noticed that ng:eval is
evaluated on
each form change but I have to fiddle with count using faking it to -1
so
that get/save requests wouldn’t make form changed. Is there a better
way
to do this?

I hope that my simple example with less than 200 lines might help
someone to
get started with angular.

I also implemented simple REST server which can be used to store data
in-memory and retrieve it. It currently doesn’t have any persistence,
but
I plan to store data in CouchDB directly (and even deploy angular
application in it) and it’s useful tool while trying different data
structures.

--
Dobrica Pavlinusic               2share!2flame
dpav...@rot13.org
Unix addict. Internet consultant.             http://www.rot13.org/~dpavlin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
VJ  
View profile  
 More options Nov 6 2010, 11:59 am
From: VJ <vojta.j...@gmail.com>
Date: Sat, 6 Nov 2010 08:59:17 -0700 (PDT)
Local: Sat, Nov 6 2010 11:59 am
Subject: Re: My first week of development using <angular/>
This is very valuable for angular, Dobrica, well done !!!

We should think about creating a section on the web, something like
reference to projects using angular...
V.

On Nov 6, 2:56 pm, Dobrica  Pavlinusic <dpav...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Misko Hevery  
View profile  
 More options Nov 6 2010, 12:18 pm
From: Misko Hevery <mi...@hevery.com>
Date: Sat, 6 Nov 2010 09:18:45 -0700
Local: Sat, Nov 6 2010 12:18 pm
Subject: Re: My first week of development using <angular/>

Hi Dobrica,

glad that you have enjoyed coding in Angular. And tanks for the write up. Do
you mind if I put some of your comments on our testimonial page?

As far as displaying a save button only on change here is an example:

http://angularjs.org/Cookbook:AdvancedForm

The basic idea is that you have a master copy which came from the server and
working copy which the user is editing.
Cancel: means copy master to working
Save: means save working and server return to master, then cancel
Enable save: when master != working.

again everything is explained here:
http://angularjs.org/Cookbook:AdvancedForm

-- misko


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dobrica Pavlinušić  
View profile  
 More options Nov 6 2010, 12:24 pm
From: Dobrica Pavlinušić <dpav...@gmail.com>
Date: Sat, 6 Nov 2010 17:24:42 +0100
Local: Sat, Nov 6 2010 12:24 pm
Subject: Re: My first week of development using <angular/>

On Sat, Nov 6, 2010 at 17:18, Misko Hevery <mi...@hevery.com> wrote:
> Hi Dobrica,
> glad that you have enjoyed coding in Angular. And tanks for the write up. Do
> you mind if I put some of your comments on our testimonial page?

Of course not :-)

> As far as displaying a save button only on change here is an example:
> http://angularjs.org/Cookbook:AdvancedForm
> The basic idea is that you have a master copy which came from the server and
> working copy which the user is editing.
> Cancel: means copy master to working
> Save: means save working and server return to master, then cancel
> Enable save: when master != working.
> again everything is explained
> here: http://angularjs.org/Cookbook:AdvancedForm
> -- misko

Damn. I should have noticed that, since I started from that example :-)

--
 ...2share!2flame... http://blog.rot13.org

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Igor Minar  
View profile  
 More options Nov 9 2010, 11:29 am
From: Igor Minar <iimi...@gmail.com>
Date: Tue, 9 Nov 2010 08:29:03 -0800
Local: Tues, Nov 9 2010 11:29 am
Subject: Re: My first week of development using <angular/>
I'm late to the party, but still wanted to say thanks :)

I looked at your code and noticed several things that we need to work
on when evangelizing and developing angular:
- angular makes TDD easy, and you should never write any angular code
without tests
- putting code into script tags in html templates will prevent you
from testing the code
- we need a better way to debug angular apps during development
- we need more examples of complicated web apps
- we need OOB integration with CouchDB as we think that they make an ideal match

Again, thanks for sharing your experience. Feel free to ask questions
when you need help.

/i

PS: and now go write some tests ;-)

On Sat, Nov 6, 2010 at 7:56 AM, Dobrica  Pavlinusic <dpav...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dobrica Pavlinusic  
View profile   Translate to Translated (View Original)
 More options Nov 10 2010, 3:34 pm
From: Dobrica Pavlinusic <dpav...@gmail.com>
Date: Wed, 10 Nov 2010 21:34:47 +0100
Local: Wed, Nov 10 2010 3:34 pm
Subject: Re: My first week of development using <angular/>

On Tue, Nov 09, 2010 at 08:29:03AM -0800, Igor Minar wrote:
> I'm late to the party, but still wanted to say thanks :)

> I looked at your code and noticed several things that we need to work
> on when evangelizing and developing angular:
> - angular makes TDD easy, and you should never write any angular code
> without tests

I totally agree, comming from perl background :-)

> - putting code into script tags in html templates will prevent you
> from testing the code

True, it was just convinient to edit single file while experimenting.

> - we need a better way to debug angular apps during development

Only combination that I found useful was firefox with firebug which
returned useful stacktraces as opposed to chrome which didn't.

> - we need more examples of complicated web apps
> - we need OOB integration with CouchDB as we think that they make an ideal match

I'm using CouchDB as back-end right now, and it's mostly direct
translation from REST requests to couch.

I would love to deploy whole applicaton (javascript, html) into couchdb
itself, which would make deployment a simple replication to public
couchdb instance :-)

> Again, thanks for sharing your experience. Feel free to ask questions
> when you need help.

> /i

> PS: and now go write some tests ;-)

I took a look under test/ in angular distribution and they look really
nice and readable. However, I don't know how to run them. text.sh
results in:

java.lang.RuntimeException: java.net.ConnectException: Connection refused

which is probably java configuration error, but I don't really know
where to start with it.

--
Dobrica Pavlinusic               2share!2flame            dpav...@rot13.org
Unix addict. Internet consultant.             http://www.rot13.org/~dpavlin

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Misko Hevery  
View profile  
 More options Nov 12 2010, 12:52 am
From: Misko Hevery <mi...@hevery.com>
Date: Thu, 11 Nov 2010 21:52:30 -0800
Local: Fri, Nov 12 2010 12:52 am
Subject: Re: My first week of development using <angular/>

to run the tests:

   1. run server.sh
   2. navigate your browser to http://localhost:9876 and click capture
   3. run test.sh
   4. edit file
   5. goto #3

-- Misko

On Wed, Nov 10, 2010 at 12:34 PM, Dobrica Pavlinusic <dpav...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Igor Minar  
View profile  
 More options Nov 12 2010, 1:10 am
From: Igor Minar <iimi...@gmail.com>
Date: Thu, 11 Nov 2010 22:10:52 -0800
Local: Fri, Nov 12 2010 1:10 am
Subject: Re: My first week of development using <angular/>
we should mention that that's the setup for angular source code.

if you want to get to the same state, you need to copy the following
files to your project dir:
- server.sh
- test.sh
- lib/jasmine-1.0.1/
- lib/jasmine-jstd-adapter/
- lib/jstestdriver/

you'll need to edit the first two files and fix the paths appropriately.

Additionally, you should copy angular files (all in
code.angularjs.org/angular-x.y.z.tgz) into lib/angular

Lastly, you'll need to create jsTestDriver.conf file in the root of
your project and fill it with something like:

server: http://localhost:9876

load:
  - lib/jasmine-1.0.1/jasmine.js
  - lib/jasmine-jstd-adapter/JasmineAdapter.js
  - lib/angular-x.y.z.js
  - src/*.js
  - lib/angular/angular-mocks-x.y.z.js
  - test/*.js

That's it. Let us know if you can't get it to work.

/i


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
VJ  
View profile  
 More options Nov 12 2010, 5:29 am
From: VJ <vojta.j...@gmail.com>
Date: Fri, 12 Nov 2010 02:29:33 -0800 (PST)
Local: Fri, Nov 12 2010 5:29 am
Subject: Re: My first week of development using <angular/>
We should write some kind of tutorial how to setup testing environment
for your project...
Angular should be only loaded as a lib, no reason for testing
angular :-D
I will do that.
V.

On Nov 12, 6:10 am, Igor Minar <iimi...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Igor Minar  
View profile  
 More options Nov 12 2010, 11:17 am
From: Igor Minar <iimi...@gmail.com>
Date: Fri, 12 Nov 2010 08:17:30 -0800
Local: Fri, Nov 12 2010 11:17 am
Subject: Re: My first week of development using <angular/>
yeah, we can write up some notes, but what I would really like to have
is a project skeleton generator. I haven't thought much about the
implementation yet, but I'd like to get to the point where creating
angular projects would be as simple as creating rails or sprout core
apps.

$ ng "my-new-app"
creating my-new-app dir... done
creating my-new-app/lib dir... done
copying latest angular to /lib... done
copying latest jstestdriver to lib/... done
copying jasmine to lib/... done
copying jasmine adapter to lib/ done
generating jstdconfig file... done
...
...

$ ng start-test-server
done

and now you are ready to start hacking :)

/i

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »