Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use angular with require
    text
    copied!<p>I am attempting to display a list of items using angular loaded via require.</p> <p>I have two files</p> <p>index.html</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;Test App&lt;/title&gt; &lt;script data-main="/Scripts/app/main" src="../Scripts/lib/require.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body ng-controller="AppCntrl"&gt; &lt;ul&gt; &lt;li ng-repeat="phone in appCntrl.phones"&gt; {{phone.name}} &lt;p&gt;{{phone.snippet}}&lt;/p&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and main.js</p> <pre><code>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']); }); </code></pre> <p>I am not getting any console errors. Just an empty page</p> <p><b>UPDATE</b></p> <p>I made an update and now getting Error[ng:areq] I think this is progress</p> <p><b>UPDATE2</b></p> <p>I am not getting error </p> <pre><code>Cannot call method '$$minErr' of undefined </code></pre> <p><b>UPDATE 3</b></p> <pre><code>Error: [ng:areq] </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload