0

I am attempting to display a list of items using angular loaded via require.

I have two files

index.html

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Test App</title>
    <script data-main="/Scripts/app/main" src="../Scripts/lib/require.js"></script>
</head>
<body ng-controller="AppCntrl">
    <ul>
        <li ng-repeat="phone in appCntrl.phones">
            {{phone.name}}
            <p>{{phone.snippet}}</p>
        </li>
    </ul>
</body>
</html>

and main.js

require.config({
    baseUrl: '/Scripts/',
    urlArgs: "bust=" + (new Date()).getTime(),
    paths: {
                 'angular': 'lib/angular/angular.min',
                 'angular-resource': 'lib/angular/angular-resource.min'
    },
    shim: {
                 'angular': { 'exports': 'angular' },
                 'angular-resource': { deps: ['angular'] }
    }
});

require(['angular', 'angular-resource'], function (angular) {
    var mainMod = angular.module('mainMod', ['ngResource']);
    mainMod.controller('AppCntrl'['$scope', function ($scope) {
        $scope.phones = [
          {
            'name': 'Nexus S',
            'snippet': 'Fast just got faster with Nexus S.'
          },
          {
            'name': 'Motorola XOOM™ with Wi-Fi',
            'snippet': 'The Next, Next Generation tablet.'
          },
          {
            'name': 'MOTOROLA XOOM™',
            'snippet': 'The Next, Next Generation tablet.'
          }
        ];
    }]);
    angular.bootstrap(document, ['mainMod']);
});

I am not getting any console errors. Just an empty page

UPDATE

I made an update and now getting Error[ng:areq] I think this is progress

UPDATE2

I am not getting error

Cannot call method '$$minErr' of undefined

UPDATE 3

Error: [ng:areq]
1
  • 1
    Missing comma after 'AppCntrl'. Commented Nov 22, 2013 at 9:53

1 Answer 1

1

I'm not sure why you are requiring angular-resource, it seems to be unneeded. Angular-route is required if you are using 1.2.0. And "appCntrl.phones" should just be "phones".

Plunker

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.