$new() or $rootScope.new() in angularjs

Are AngularJs controllers singletons ?

AngularJs code-sample

var app = angular.module('singletonApp', []);

app.controller('singletonTest', function ($scope, singletonService) {
    $scope.name = singletonService.getValue();

app.service('singletonService', function () {
    var field = {
        value: 'hello Anil'
    var getValue = function () {
        return val;
    return {
        getValue: getValue

HTML code

<div ng-app="singletonApp">
    <div ng-controller="singletonTest">
            <input type="text" ng-model="name.value" />


Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - http://code-sample.com and http://code-sample.xyz
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
www.code-sample.com/. Powered by Blogger.
ASK Questions