I'm looking to have a form that a user can submit which populates a div 
that displays what they entered. Easy enough with a binding.

However, I'm looking to have the updating div available to all pages, to 
all people (not just the person who submitted the form). Essentially, a 
notification center that changes based on user inputs.

 1. I assume I'll have to have the form submit the values to a service to 
update a model. Is there a way to watch the model and when it changes, do 
something?
 2. Would it make more sense to post the data to a web service to save to a 
database, then have the controller do a lookup on that database at a set 
interval and update accordingly?
 3. **Most importantly**, what would the controller & model setup look for 
something like this? I'm not sure if my current setup is conducive to what 
I'm trying to do, but I cannot find any examples like this online.

Currently, I have a view and an associated controller (this main controller 
does an $http call to retrieve data from a service and populate the view). 
Within that view, I have the form, which I've added another controller 
directly to. Because I don't really know where to begin, I've just got the 
controller alerting the value entered into the form.

**View containing form**

    <form name="form" novalidate ng-controller="CustomBrewController" 
ng-submit="submitCustomBrew(custom)">
      <div class="row">
        <label for="name">Name:</label>
        <input type="text" name="name" ng-model="custom.person" required 
placeholder="E.g. Steve">
      </div>
    </form>
**Controller for form**

    BrewGuide.controller("CustomBrewController", function ($scope) {
        $scope.submitCustomBrew =  function(custom) {
            alert(custom.person);
        }
    });

To recap: I would like to figure out a way to have a form that sits in a 
specific view that when submitted, has its values pushed to a div that is 
visible on every page by anyone on the site (not just the person who 
submitted the form). Unfortunately I've got separate views and service 
calls to my local machine, so setting up a working example isn't an option.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to