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 " /> </ div > </ div > For more, go to link http://bl...
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers