I know I'm missing something simple

20 views
Skip to first unread message

Jonathan Price

unread,
Dec 12, 2015, 1:00:15 AM12/12/15
to AngularJS
What am I missing?!

My html:

<div class="container-fluid" ng-controller="DashboardCtrl as dash">
<input ng-model="dash.customerId" />
{{ dash.customerId }}
</div>

My Controller:

(function () {

'use strict';

angular
.module('ngXmdDashboard')
.controller('DashboardCtrl', DashboardCtrl);

DashboardCtrl.$inject = [ 'Customers' ];

function DashboardCtrl( Customers ) {
var vm = this;
vm.customerId = 1;

var updateCustomers = function() {
vm.customerId = 2;
};

Customers.subscribe(updateCustomers);
})();

My Service:

(function () {

'use strict';

angular
    .module('ngXmdDashboard')
    .factory('Customers', Customers);

Customers.$inject = [ 'Data' ];

function Customers( Data ) {

    return {
        subscribe:      subscribe
    };

    function subscribe(cb) {
       cb();
    }
}
})();


When I load the page, I'm not seeing 1 as my bound value in the view.  When I look in dev tools, I see that dash.customerId is set correctly to 2.  

I'm just getting back to using angular, and I'm stumping my toe on something dumb here.  Sorry to bog down the board with a likely dumb questions.  Thanks.

Jonathan Dryhurst Roberts

unread,
Dec 12, 2015, 1:14:58 AM12/12/15
to AngularJS
Did you bother to read the guidelines to this board? Please read them and knock it off with the self deprecating nonsense too in the hopes we feel sorry for you. 

Puritan Paul

unread,
Dec 12, 2015, 1:16:57 AM12/12/15
to ang...@googlegroups.com
Yep, got it.


--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/GdzTx2beZ7g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages