Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Modal - Add bindToController #3404

Closed
eranimo opened this issue Mar 18, 2015 · 8 comments
Closed

Modal - Add bindToController #3404

eranimo opened this issue Mar 18, 2015 · 8 comments

Comments

@eranimo
Copy link

eranimo commented Mar 18, 2015

It would be nice to have a bindToController option for the $modal service. This would allow resolves to be bound to the controller instead of the scope much like it does in directives in Angular 1.3.

See the Angular documentation for bindToController:

When an isolate scope is used for a component (see above), and controllerAs is used, bindToController: true will allow a component to have its properties bound to the controller, rather than to scope. When the controller is instantiated, the initial values of the isolate scope bindings are already available.

https://docs.angularjs.org/api/ng/service/$compile

@Foxandxss
Copy link
Contributor

First we need to see if we want to break compatibility with 1.2.x

@wesleycho
Copy link
Contributor

I think we've already broken compatibility with 1.2.x with the ngAnimate changes.

@wesleycho wesleycho modified the milestones: 0.14, 1.0 Mar 23, 2015
@wesleycho wesleycho modified the milestones: 0.13.x, 1.0 Mar 30, 2015
@iyeldinov
Copy link

+1

@awerlang
Copy link

awerlang commented May 1, 2015

scope - a scope instance to be used for the modal's content 
(actually the $modal service is going to create a child scope of a provided scope). 
Defaults to $rootScope

I receive them on controller constructor function. As I use TypeScript, I'm able to prefix them with either public or private in order to have automatic properties.

Isn't your use case covered by means of constructor function parameters? Or perhaps I'm missing something?

@ouchxp
Copy link

ouchxp commented Jun 27, 2015

+1 for this.
The inconsistency of controller syntax is really important.
In the mean time. This issue really bothers our new angularjs developers. We have to add exceptions to the coding guideline that explain to our developers that when and why they are allow to break this consistency. That's really painful experience.

@Quirksmode
Copy link

+1

@kamarouski
Copy link

+1

As we have Angular 2.0 coming it's generally recommended not to use $scope anymore and prefer bindToController for directives.

The absence of bindToController is frustrating and painful.

@wesleycho wesleycho self-assigned this Jul 19, 2015
@wesleycho
Copy link
Contributor

I'll take a look at implementing this tomorrow.

@wesleycho wesleycho modified the milestones: 0.13.1 (Performance), 0.13.x Jul 19, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants