tagged [scope]

What's the correct way to communicate between controllers in AngularJS?

What's the correct way to communicate between controllers in AngularJS? What's the correct way to communicate between controllers? I'm currently using a horrible fudge involving `window`: ``` function...

12 Feb at 13:35

Why use a public method in an internal class?

Why use a public method in an internal class? There is a lot of code in one of our projects that looks like this: Is there any explicit reason to do this other than "it is easier to make the type

22 May at 01:47

AngularJS access parent scope from child controller

AngularJS access parent scope from child controller I've set up my controllers using `data-ng-controller="xyzController as vm"` I have a scenario with parent / child nested controllers. I have no prob...

28 Dec at 06:47

Is this really an improvement (moving var to inner scope when inner scope is in a loop)?

Is this really an improvement (moving var to inner scope when inner scope is in a loop)? Resharper recommends that these vars: ...c

17 Dec at 21:47

What is the difference between Dim, Global, Public, and Private as Modular Field Access Modifiers?

What is the difference between Dim, Global, Public, and Private as Modular Field Access Modifiers? In VB6/VBA, you can declare module-level variables outside of a specific `Sub` or `Function` method. ...

28 Sep at 17:52

How do I declare a global variable in VBA?

How do I declare a global variable in VBA? I wrote the following code: And I get the error message: > "invalid attribute in Sub or Function" Do you know what I did wrong? I tried to use `Global` inste...

8 Jul at 19:39

Nested classes' scope?

Nested classes' scope? I'm trying to understand scope in nested classes in Python. Here is my example code: The creation of class does not complete and I get the error: Trying `inner_var = Outerclass....

Cannot use local variable before it is declared

Cannot use local variable before it is declared I am trying to create a function but I'm getting an error message. > Cannot use local var

30 Jul at 00:22

Java, "Variable name" cannot be resolved to a variable

Java, "Variable name" cannot be resolved to a variable I use Eclipse using Java, I get this error: With this Java program: ``` public class SalCal { private int hoursWorked; public SalCal(String n...

6 Sep at 03:10

Best way to access properties of my code behind class from the markup in ASP.NET

Best way to access properties of my code behind class from the markup in ASP.NET Let's say I have two files `default.aspx` and the associated `default.aspx.cs`. default.aspx.cs: Is there a way that in...

11 Oct at 22:44

variable scope in statement blocks

variable scope in statement blocks ``` for (int i = 0; i

22 Apr at 17:43

AngularJS : Prevent error $digest already in progress when calling $scope.$apply()

AngularJS : Prevent error $digest already in progress when calling $scope.$apply() I'm finding that I need to update my page to my scope manually more and more since building an application in angular...

Additive Chaining with named_scope

Additive Chaining with named_scope Is there a way to combine scopes in an additive fashion? If I have the scopes and I can call and get all the users who have big hair AND play guitar. Can I write thi...

What's the scope of a variable initialized in an if statement?

What's the scope of a variable initialized in an if statement? This could be a simple scoping question. The following code in a Python file (module) is confusing me slightly: In other languages I've w...

Is it better to declare a variable inside or outside a loop?

Is it better to declare a variable inside or outside a loop? Is better do: Or: ``` foreach(var val in list) { variable1Type foo = new Foo( ... ); foo.x = FormatValue(val); variable2T

25 Dec at 09:51

Variable declared in for-loop is local variable?

Variable declared in for-loop is local variable? I have been using C# for quite a long time but never realised the following: ``` public static void Main() { for (int i = 0; i

15 Apr at 18:39

Use of symbols '@', '&', '=' and '>' in custom directive's scope binding: AngularJS

Use of symbols '@', '&', '=' and '>' in custom directive's scope binding: AngularJS I have read a lot about the use of these symbols in the implementation of custom directives in AngularJS but the con...

C# - anonymous functions and event handlers

C# - anonymous functions and event handlers I have the following code: ``` public List FindStepsByType(IWFResource res) { List retval = new List(); this.FoundStep += delegate(object sender, Wa...

23 May at 11:21

Is there any way to use SCOPE_IDENTITY if using a multiple insert statement?

Is there any way to use SCOPE_IDENTITY if using a multiple insert statement? I will import many data rows from a csv file into a SQL Server database (through a web application). I need the auto genera...

18 Jan at 23:26

How do I scope variables properly in jQuery?

How do I scope variables properly in jQuery? I'm working on a jQuery plugin, but am having some trouble getting my variables properly scoped. Here's an example from my code: ``` (function($) { $.fn.ks...

28 May at 20:41

TransactionScope With Files In C#

TransactionScope With Files In C# I've been using TransactionScope to work with the database and it feels nice. What I'm looking for is the following: but obviously this doesn't work -- if there are 2...

Short description of the scoping rules?

Short description of the scoping rules? What are the Python scoping rules? If I have some code: Where is `x` found? Some possible choices include the list below: 1. In the enclosing source file 2. In ...

12 Sep at 11:16

What is the scope of a lambda variable in C#?

What is the scope of a lambda variable in C#? I'm confused about the scope of the lambda variable, take for instance the following ``` var query = from customer in clist from order in olist .Whe...

8 May at 19:28

How do I inject a controller into another controller in AngularJS

How do I inject a controller into another controller in AngularJS I'm new to Angular and trying to figure out how to do things... Using AngularJS, how can I inject a controller to be used within anoth...

Overwriting iframe's document.write

Overwriting iframe's document.write For my own purposes ( lazy-loading an ad script), I am overwriting the document.write function in order to buffer the script's output, writing it to a div, and rest...