Quantcast
Channel: MarsHut
Viewing all articles
Browse latest Browse all 6551

Data Binding Form Inputs to the Cookie

$
0
0
Hi Internet People,

Today at work, I was given a spec to remember specific <select>'d options
on a form after a user refreshes the page. No not on form saves, but when a
user makes their selection so that it is saved temporarily on their session
before they commit to it on the server. This meant data binding to the
$cookie. I would like your feedback on my solution to this request. Here's
the snippet: http://plnkr.co/edit/YoHGRPeZlAC9NqVJuxvI?p=preview

It is a service where you pass the scope, the form object in that scope
that needs session saving, and a strings of the property of the form you
want to save.

Is this an optimal solution? More specifically, does it break any best
practice?

My worry is if this service will create too many watches or pollute the
session cookie.

Best,
i❤computers

Viewing all articles
Browse latest Browse all 6551

Trending Articles