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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:54:18+00:00 2026-06-15T09:54:18+00:00

Tryin’ to get started with testing in angularjs (based on this ) but can’t

  • 0

Tryin’ to get started with testing in angularjs (based on this) but can’t seem to get the mocks working correctly. Here’s my jasmine file:

describe 'FlightsController', ->
  beforeEach module 'surf-air'

  beforeEach inject ($rootScope, $controller) ->
    scope = $rootScope.$new()
    FlightsController = $controller('FlightsController', {scope: scope})

  it 'should work', -> expect(true).toBe(true)

And here’s what Testacular spits back:

Chrome 23.0 FlightsController should work FAILED
    Error: Unknown provider: $scopeProvider <- $scope
        at Error (<anonymous>)
        at /Users/chriskun/forge-workspace/surf-air-pilot-mobile/src/js/angular.min.js:28:395
        at Object.c [as get] (/Users/chriskun/forge-workspace/surf-air-pilot-mobile/src/js/angular.min.js:26:180)
        at /Users/chriskun/forge-workspace/surf-air-pilot-mobile/src/js/angular.min.js:28:476
        at c (/Users/chriskun/forge-workspace/surf-air-pilot-mobile/src/js/angular.min.js:26:180)
        at d (/Users/chriskun/forge-workspace/surf-air-pilot-mobile/src/js/angular.min.js:26:314)
        at Object.instantiate (/Users/chriskun/forge-workspace/surf-air-pilot-mobile/src/js/angular.min.js:27:455)
        at /Users/chriskun/forge-workspace/surf-air-pilot-mobile/src/js/angular.min.js:50:239
        at null.<anonymous> (/Users/chriskun/forge-workspace/surf-air-pilot-mobile/test/unit/controllers.js:9:34)
        at Object.d [as invoke] (/Users/chriskun/forge-workspace/surf-air-pilot-mobile/src/js/angular.min.js:27:325)
    Error: Declaration Location
        at window.jasmine.window.inject.angular.mock.inject (/Users/chriskun/forge-workspace/surf-air-pilot-mobile/test/lib/js/angular-mocks.js:1717:25)
        at null.<anonymous> (/Users/chriskun/forge-workspace/surf-air-pilot-mobile/test/unit/controllers.js:6:16)
        at /Users/chriskun/forge-workspace/surf-air-pilot-mobile/test/unit/controllers.js:4:3
        at /Users/chriskun/forge-workspace/surf-air-pilot-mobile/test/unit/controllers.js:18:4
Chrome 23.0: Executed 1 of 1 (1 FAILED) (0.221 secs / 0.04 secs)

which is caused by:

$controller('FlightsController', {scope: scope})

Any ideas?

  • 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-15T09:54:20+00:00Added an answer on June 15, 2026 at 9:54 am

    Change this line

    FlightsController = $controller('FlightsController', {scope: scope})
    

    to the following

    FlightsController = $controller('FlightsController', {$scope: scope})
    

    I have updated the example jsfiddle to CoffeeScript: http://jsfiddle.net/jaimem/5Afbm/2/

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

Sidebar

Related Questions

Hello im tryin to use Twitter with OAuth but i receive this exception Authorization
im tryin to send a 2d array in simple socket program..but this only sends
Ive been tryin to solve this for a long time and now know why
I'm tryin to grasp the fundamentals of Cocoa (Iphone) MVC design, but it's being
been playing around with ResolveClientUrl(~/Confirmation.aspx) and other methods.. I am tryin go get the
i'm facing a problem tryin to execute a simples jquery inside my userControl. This
I'm new to ocaml and tryin to write a continuation passing style function but
I was tryin to find any class to define a password field? How can
I'm tryin to get the id of an option chosen in a select by
I'm tryin to use boost threads on mingw (TDM-mingw, 32bit based on gcc4.6) from

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.