display my first data

29 views
Skip to first unread message

Xavier Artot

unread,
Sep 9, 2014, 4:00:49 PM9/9/14
to ang...@googlegroups.com
Hi,
I reading a lot how can i display some data with the template.
But doesn't work ?
My js:
https://gist.github.com/xavierartot/807f84984cc986ed02ea

HTML:
https://gist.github.com/xavierartot/7e9ba2239e961981d921

Thanks

André Farzat

unread,
Sep 10, 2014, 11:24:24 AM9/10/14
to ang...@googlegroups.com
Hi,

you're using `this` instead of `$scope` inside the controller. So you can't access the properties without naming its controller using the controllerAs syntax.

A quickfix is changing the `this.entite = test;` to `$scope.entite = test;`.

This stackoverflow answer explains well the difference between `this` and `$scope`: http://stackoverflow.com/questions/11605917/this-vs-scope-in-angularjs-controllers and todd has written an article about the new controllerAs syntax: http://toddmotto.com/digging-into-angulars-controller-as-syntax/

Xavier Artot

unread,
Sep 10, 2014, 2:29:16 PM9/10/14
to ang...@googlegroups.com
Thank for that!
But the $scope in my case I tried the first time.
Actually, I reorganise my code with services and some getter.


--
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/aLRQ9TYzUA8/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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.



--

Xavier ARTOT



Reply all
Reply to author
Forward
0 new messages