Hello,

I am just starting out with AngularjS and I have got the following example 
code:




*test.js'use strict';myApp.factory('test', ['$q', function($q) {           
var $this = function() {                        angular.extend(this, {     
                     one: one                        });             };     
                    function one() {                        return 'one';   
        }                                          return $this;   }]);*
*controllers.js*

'use strict';

myApp.controller('TestController', ['$scope', 'test', function($scope, test) 
{
 console.log(test.one);
        }]
);

*modules.js*

'use strict';

var myApp = angular.module('myApp', ['ngRoute']);

*demo.html*

<html ng-app="myApp">
  <head>
         <script src=
"http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js";
></script>
           <script src=
"http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular-route.min.js";
></script>
           <script src="./modules.js"></script>
           <script src="./test.js"></script>
           <script src="./controllers.js"></script>
           <title>AngularJS Demo</title>
  </head>
<body ng-controller="TestController">
            <h1>AngularJS Demo</h1>
</body>
</html>

I don't know what test.one is being output as undefined to the console.

I was expecting '*one*' to be displayed as this is the result of the 
function call.

Am I doing something wrong here?

Thanks in advance.


-- 
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/d/optout.

Reply via email to