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 9282167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T18:18:23+00:00 2026-06-18T18:18:23+00:00

I am currently evaluating AngularJS as a potential MVC framework. I am wondering on

  • 0

I am currently evaluating AngularJS as a potential MVC framework. I am wondering on what the “correct” way to implement the following scenario is –

Say I am designing an User detail page. It is broken down into different tabs like basic information tab(name, email…), user interests tab(drop downs like sports, music..), etc.

So the code looks like this:

                    <!-- main.html-->
                    <div ng-controller="UserController">
            <div ng-switch on="renderPath">
                <div ng-switch-when="basicInfo">
                     <div ng-include src="basicUrl"></div>
                </div>
                <div ng-switch-when="interests">
                     <div ng-include src="interestUrl"></div>
                </div>
            </div>
        </div>

and interests.html looks like

    <div>
        <div class="dropdown">
            <a class="dropdown-toggle" id="dLabel" role="button" data-toggle="dropdown" data-target="#" href="/page.html">
            I like to play:
             </a>
            <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
                <li ng-repeat="sport in sports">{{sport}}</li>
            </ul>
            <a class="dropdown-toggle" id="A1" role="button" data-toggle="dropdown" data-target="#" href="/page.html">
            I like to listen to:
            </a>
            <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
                <li ng-repeat="genre in genres">{{genre}}</li>
            </ul>
        </div>
    </div>  

So the question is, asides from the UserController, should I create a separate controller for the “basicInfo” and “interests” tabs? The reason why I may want to create InterestsController is because I don’t necessary think

$scope.sports= ['baseball', 'bastketball'];
$scope.genres= ['pop', 'classical'];

should live in the UserController since only Interest.html cares about the different selections of interests. Also UserController may get real fat real quick since the page will have many other tabs.

But at the same time, in Angular’s documentation – *”In Angular, a model is any data that is reachable as a property of an angular Scope object“*, I feel like if I do then have an InterestsController, etc, its model is rather arbitrary since it is just containing the information needed for that tab only.

So what’s the best practice? I hope I explain myself clearly.
Thank you.

  • 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-18T18:18:24+00:00Added an answer on June 18, 2026 at 6:18 pm

    Here’s one approach to designing an Angular app:

    1. Think about your models (e.g., User). Create services for those models.
    2. Think about how you want to view your models — your views (e.g., user-main (tabbed), user-basic, user-interests). Create HTML templates for those views.
    3. Lastly, attach a controller to each view (using ng-view and routing, or ng-controller for every other way, such as what you are doing with ng-switch and ng-include). Have the controller find/get only whatever model data the view needs to do its job.
      “Make controllers as thin as possible” — this was said somewhere in the DoubleClick talk.

    For your particular example, I think the basicInfo and interests tabs should have their own controllers, because they are two distinct views. Note that each page can have multiple views on it — all visible, or only some. How big or small a “view” is is up to you.

    There is confusion about $scope, model, and services. Misko says in this YouTube video that “Scope is not your model. Scope is what you attach your model to.“
    In a comment exchange with Brandon Tilley, he had this to say about putting your models into services: “Services are especially good for model objects because they can be injected, and thus easily mocked in tests.”

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

Sidebar

Related Questions

I'm currently evaluating QtQuick (Qt User Interface Creation Kit) which will be released as
I'm currently evaluating the possibilities to implement a navigable 3D scene which allows to
We're currently a Linq to SQL shop but evaluating Entity Framework. One thing that
I am currently evaluating the Microsoft sync framework as a possible solution to sync
I have currently evaluating Java based security frameworks, I am a Spring 3.0 user
Am currently evaluating a build tool/framework. I need to meticulously record my findings and
I'm currently evaluating the right solution for the following app: The main goal is
I'm currently evaluating Windows Server AppFabric as a distributed cache solution. If we implement
I'm currently evaluating a few JavaScript frameworks and right now I'm working with AngularJS.
I am currently evaluating ASP.NET MVC as a possible technology for a web project.

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.