Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9187201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:42:39+00:00 2026-06-17T19:42:39+00:00

I am new to AngularJS and trying to have following code working. This’s actually

  • 0

I am new to AngularJS and trying to have following code working.

This’s actually the code from AngularJS tutorial with minor modification. What I have changed was I made all directives as class instead of attribute.

Issue is AngularJS can bootstrap successfully, and the expression {{ 1 + 2 }} can be evaluated. But ng-controller seems not be recognised and the following ng-repeat doesn’t work neither.

I have checked AngularJS API document and it says ng-controller can be used as a class.

Could anyone who got experience in using AngularJS directives as classes help me on this?

ng-controller as class(not working): http://jsfiddle.net/qZmky/

ng-controller as attribute(working): http://jsfiddle.net/p45Uv/

<html class="ng-app">
<p>Nothing here {{1 + 2}}</p>
<head>
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js">    </script>
  <script>
    function PhoneListCtrl($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."}
       ]; 
    }
   </script>
</head>
<body class="ng-controller: PhoneListCtrl;">
  <ul>
    <li ng-repeat="phone in phones;">
      {{phone.name}}
      <p>{{phone.snippet}}</p>
    </li>
  </ul>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:42:40+00:00Added an answer on June 17, 2026 at 7:42 pm

    Got answer from the AngularJS mailing list, the API document is actually wrong….

    please reference the following for detail:

    https://groups.google.com/forum/?fromgroups=#!searchin/angular/ng-controller/angular/5-regnflDD4/VR4fqdEVtM8J

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to angularjs and python and I have this problem. I've been trying
New to PHP and MySQL, have heard amazing things about this website from Leo
New programmer here, I am trying to understand and break down this code below
I have a lot of angularjs code (written by a colleague) and I'm trying
I'm new to AngularJS and i'm trying to imagine myself, how to do this
I'm new to AngularJS, so this might actually point to some core concept that
I am fairly new to using AngularJS, and what I am trying to do
I am new to angularjs world and am trying to do something that I
I'm trying to learn AngularJS. My first attempt to get new data every second
I have begun with the code from angular-seed , and am slowly changing it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.