I am learning Angular.js and the more I read about it the more I love it. Yet I think Angular.js is not web2py but Angular.js may be for web3py (or however we call it).
Web2py has a design which is MVC and the V(iews) are created serverside using a template language. Angular is not a replacement for jQuery. It is a replacement for the template language. The purpose of angular is that building one page applications that talk to the server using almost exclusively web services. So Angular aims to replace something that is fundamental in web2py, its server side MVC architecture. Yet I can imagine a future where we retain: - the web IDE - the dal.py (because it is great) - a lighter version of dispathing and routing (perhaps bottle.py) - the web2py form generation (or the new form.py in gluino) and server side form validation - the web2py RESTful services (or something better) But we ditch web2py templates completely, we use angular for client-side templates, and we only communicate data from client-server using json. A minor problem with all of this is that some times one needs to generate HTML based on the value of variables that should not be exposed to the user. For example I may have a green button if I have a positive bank account balance and a red button if the balance is negative, but I may not want to show the balance. In web2py this is easy. In Angular one would have to create a new variable (boolean) pass it to the client and have the client decide the color based on the boolean. Angular constrains you more but forces you to be more disciplined. Massimo On Wednesday, 19 February 2014 10:06:03 UTC-6, Richard wrote: > > > http://stackoverflow.com/questions/18414012/why-use-angularjs-instead-of-jquery > > http://stackoverflow.com/questions/13151725/how-is-angular-js-different-from-jquery > > http://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-background > > Richard > > > > > On Wed, Feb 19, 2014 at 11:04 AM, Richard Vézina > <[email protected]<javascript:> > > wrote: > >> jQuery vs Angular you can't make that kind of simple comparaison they >> both design for solving different kind of problem. jQuery is good as >> manipulating DOM element. Angular is design to make very easy the >> development of SPA... >> >> Richard >> >> >> On Wed, Feb 19, 2014 at 10:46 AM, Arvind Gupta >> <[email protected]<javascript:> >> > wrote: >> >>> There is enough buzz around Angular over net, I haven't program web2py >>> also. I have to choose django vs web2py for a personal project, I m >>> evaluating my options, Which is easy to get started, Angular or Jquery? >>> >>> -arvind >>> >>> >>> On Wed, Feb 19, 2014 at 7:53 PM, Richard Vézina >>> <[email protected]<javascript:> >>> > wrote: >>> >>>> Your question is vague... I suggest you to listen a couple of video on >>>> youtube about Angular.js... There is many talk about what the limitation >>>> you face using Angular.js and jQuery for instance, since Angular.js use a >>>> different paradigm at generating dom instead of manipulating it. So there >>>> is thing that works if you manipulate dom with angular and thing that >>>> don't >>>> work and make thing disconnected. I just start learning Angular so can't >>>> help you that much... >>>> >>>> Richard >>>> >>>> >>>> On Tue, Feb 18, 2014 at 8:39 PM, Arvind Gupta >>>> <[email protected]<javascript:> >>>> > wrote: >>>> >>>>> @derek and @richard if we have to create generic support of other >>>>> javascript libraries, what are the efforts one have to make? >>>>> >>>>> >>>>> On Wed, Feb 19, 2014 at 2:48 AM, Richard Vézina >>>>> <[email protected]<javascript:> >>>>> > wrote: >>>>> >>>>>> Good point Derek, I saw it in angular.js file when I test the slice >>>>>> (that at least work), as you say it is a cleaner approach... >>>>>> >>>>>> :) >>>>>> >>>>>> Richard >>>>>> >>>>>> >>>>>> On Tue, Feb 18, 2014 at 4:01 PM, Derek <[email protected]<javascript:> >>>>>> > wrote: >>>>>> >>>>>>> no, no, no, do not use that slice, it's a waste of time to edit the >>>>>>> angular.js file itself. you want to do that every time a new version is >>>>>>> released? also why not just use a cdn for angular.js? >>>>>>> >>>>>>> http://docs.angularjs.org/api/ng/provider/$interpolateProvider# >>>>>>> startSymbol >>>>>>> The above link shows how to do it properly. >>>>>>> >>>>>>> Here's a snippet from their 'sample' code... >>>>>>> >>>>>>> var customInterpolationApp = >>>>>>> angular.module('customInterpolationApp', []); >>>>>>> customInterpolationApp.config(function($interpolateProvider) { >>>>>>> $interpolateProvider.startSymbol('//'); >>>>>>> $interpolateProvider.endSymbol('//'); >>>>>>> >>>>>>> That changes the start and end symbols to '//' but you could just as >>>>>>> easily change them to '[[' and ']]' or '||' and '||' or whatever you >>>>>>> want. >>>>>>> >>>>>>> On Tuesday, February 18, 2014 1:19:14 PM UTC-7, Richard wrote: >>>>>>> >>>>>>>> http://www.web2pyslices.com/slice/show/1922/web2py-angularjs >>>>>>>> >>>>>>>> Change angular {{ }} for {! !} >>>>>>>> >>>>>>>> Having to type to different character bug me though, but you need a >>>>>>>> closing tag... >>>>>>>> >>>>>>>> :( >>>>>>>> >>>>>>>> Richard >>>>>>>> >>>>>>>> >>>>>>>> On Tue, Feb 18, 2014 at 3:05 PM, Derek <[email protected]> wrote: >>>>>>>> >>>>>>>>> and to note you can change the brackets in angular to use >>>>>>>>> something else... >>>>>>>>> >>>>>>>>> see here: >>>>>>>>> >>>>>>>>> http://docs.angularjs.org/api/ng/service/$interpolate >>>>>>>>> >>>>>>>>> by default it uses {{ and }} as starting and ending brackets. >>>>>>>>> >>>>>>>>> >>>>>>>>> On Tuesday, February 18, 2014 12:59:48 PM UTC-7, Derek wrote: >>>>>>>>>> >>>>>>>>>> Well, the problem you have is that if you put angular tags in >>>>>>>>>> your views, they will be parsed with the template parser of web2py >>>>>>>>>> and >>>>>>>>>> error. The way to avoid that is to use the angular classes instead. >>>>>>>>>> For >>>>>>>>>> example, all the 'ng-app' and 'ng-controller' and 'ng-repeat' >>>>>>>>>> attributes ( >>>>>>>>>> http://docs.angularjs.org/tutorial/step_02). Keep in mind that >>>>>>>>>> the python template language will get parsed first, and only after >>>>>>>>>> that >>>>>>>>>> will the angular template parser be used. >>>>>>>>>> >>>>>>>>>> On Tuesday, February 18, 2014 12:49:42 PM UTC-7, Arvind Gupta >>>>>>>>>> wrote: >>>>>>>>>>> >>>>>>>>>>> Can we use angular.js with web2py, if yes can u point me to >>>>>>>>>>> appropriate resources? >>>>>>>>>>> >>>>>>>>>> -- >>>>>>>>> Resources: >>>>>>>>> - http://web2py.com >>>>>>>>> - http://web2py.com/book (Documentation) >>>>>>>>> - http://github.com/web2py/web2py (Source code) >>>>>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>>>>>>> --- >>>>>>>>> You received this message because you are subscribed to the Google >>>>>>>>> Groups "web2py-users" group. >>>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>>> send an email to [email protected]. >>>>>>>>> >>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>> Resources: >>>>>>> - http://web2py.com >>>>>>> - http://web2py.com/book (Documentation) >>>>>>> - http://github.com/web2py/web2py (Source code) >>>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>>>>> --- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "web2py-users" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to [email protected] <javascript:>. >>>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>>> >>>>>> >>>>>> -- >>>>>> Resources: >>>>>> - http://web2py.com >>>>>> - http://web2py.com/book (Documentation) >>>>>> - http://github.com/web2py/web2py (Source code) >>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>>>> --- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "web2py-users" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected] <javascript:>. >>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>> >>>>> >>>>> -- >>>>> Resources: >>>>> - http://web2py.com >>>>> - http://web2py.com/book (Documentation) >>>>> - http://github.com/web2py/web2py (Source code) >>>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>>> --- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "web2py-users" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected] <javascript:>. >>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>> >>>> >>>> -- >>>> Resources: >>>> - http://web2py.com >>>> - http://web2py.com/book (Documentation) >>>> - http://github.com/web2py/web2py (Source code) >>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "web2py-users" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected] <javascript:>. >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>> >>> -- >>> Resources: >>> - http://web2py.com >>> - http://web2py.com/book (Documentation) >>> - http://github.com/web2py/web2py (Source code) >>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "web2py-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected] <javascript:>. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

