Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
glompix
Jan 19, 2004

propane grill-pilled
Speaking of the application cache, when you use that, does your application just give up on network calls altogether? That's what mine's doing. I haven't read anything to lead me to believe this is how it's supposed to work, so I think I'm doing something stupid or am misunderstanding something.

See screenshot below from my application. It will just not grab anything over the network. (Facebook login for example) Here's my appcache manifest.



Maybe I just need to read more. I've looked at everything I could find on MDN, HTML5Rocks, and appcachefacts.info.

Adbot
ADBOT LOVES YOU

glompix
Jan 19, 2004

propane grill-pilled

an skeleton posted:

AngularJS question ahead:
I'm trying to turn off a save button based on one of the inputs inside of an ngGrid (populated dynamically based on data) being invalid. It may not be possible, but does anyone have any bright ideas?

Angular newbie here, but I do something like this in one of my apps. Here's what I do in my controller:

code:
$scope.canSave = function () { return $scope.c.data.name && $scope.c.json() !== $scope.localCharacterJson; };
And my view:

code:
<li><a ng-disabled="!canSave()" ng-click="save()">Save</a></li>
I'm simply checking the serialized state of $scope.c against a cache to see if anything new needs to be saved. My $scope.save() method can also check $scope.canSave and immediately return without doing work if it's not allowed.

It's not much different if you're simply validating. Just replace what's in canSave with your own validation logic. Of course, this assumes your textbox is ng-model-bound. Sounds like it should be.

glompix fucked around with this message at 20:41 on Jan 31, 2014

glompix
Jan 19, 2004

propane grill-pilled

an skeleton posted:

I may be misunderstanding the solutions offered, but I don't think either of those help me. I need to be able to disable a save button, without access to form names, or at least I am finding it very difficult to find the form names. I have an angular foreach() function going through each row, and I tried to check if the forms are valid by seeing if getElementsByClassName('ng-invalid') had an index of >-1, but I can't figure out how to find the element name to check for it. So I am thoroughly confused right now.

Can you post some of your code? In my experience, Angular and other MV* frameworks are very good about making it so you don't have to reach into the DOM by hand to do stuff like that.

glompix
Jan 19, 2004

propane grill-pilled

Skiant posted:

Get all your controllers and services in one single file, using automation tools like gulp-concat, gulp-ng-annotate and then gulp-uglify

For my last project I just decided I want to do whatever angular-fullstack is doing. Still haven't learned how every little thing works but all the injection/bower-related work it does is priceless.

glompix
Jan 19, 2004

propane grill-pilled

caiman posted:

So are CRUD operations common in an average Angular application? Or is that not what it's intended for?

If you want to dive in new backends a bit, get Yeoman and generate an app using angular-fullstack. It has an Express backend that talks to a MongoDB database. It's kind of the Javascript hipster equivalent to a php/mysql server. You can use other backends like PHP or ASP.NET, but this is stack is pretty popular nowadays.

With a NoSQL database like Mongo the idea is that your JSON document is your datarow and your primary key is a GUID. You could certainly go with a relational model and put together JSON from the result of a SQL query if your app benefits from that kind of system. For many apps it simply doesn't matter and you just want to store some poo poo on a server and don't want to deal with managing schema or other bullshit.

Adbot
ADBOT LOVES YOU

glompix
Jan 19, 2004

propane grill-pilled

pigdog posted:

Which is why every Angular guide and official documentation strongly encourages using array syntax which doesn't break.

There's even a grunt task that will change it to use the array syntax before minification, so you if you use that you don't even have to worry about it.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply