Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

Am learning angularjs. I want to now is it possible to create constructor in angular? if it is yes, how to create constructor for controller? can any one help me on this thanks,

share|improve this question
    
Basically, the .controller(..) method is the constructor. Maybe you can be more explicit about you have in mind and how the standard way of doing things doesn't fit that? – deceze Feb 3 at 9:48
    
    
Create one function and assign the function to the controller, like: angular.module('appName').controller('ctrlName', constructorFunction);. But it'll be difficult to inject providers, if you want to minimize the code. – Arnab Das Feb 3 at 9:49
    
There is no concept of constructor in angularjs. – ashfaq.p Feb 3 at 9:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.