How to Injected to Angular objects?

An object is a block of code that has been allocated or configured according to your custom logic. A program may create many objects of the same class. 

In AngularJs, A controller class can contains many object like module object, array module etc. 

In the below example, I am going to share the how to Inject the objects and use of objects. Please see the detail as given below.

<!DOCTYPE html>
    <meta charset="utf-8" />
    <title>injected to Angular objects </title>
    <script src=""></script>
        var app = angular.module('diApp', []);
        app.controller('diCtrl', ['$scope', '$http', function ($scope, $http) {

            $scope.countries = [{
                "name": "India"
            }, {
                "name": "USA"
            }, {
                "name": "Nepal"
            }, {
                "name": "Indonesia"
            }, {
                "name": "Brasil"
<body ng-app="diApp" ng-controller="diCtrl">
                <h2>Country List</h2>
        <div ng-repeat="country in countries">
            <div> {{}}</div>

About Blogger


Hey! I am Anil Singh. I am Active Blogger, Writer and Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...

    Blogger Comment
    Facebook Comment
SQL Server NodeJs TypeScript JavaScript Angular SQL Server My Book