Lost
Lost

Reputation: 13655

Problems getting Plunker running for Angular

I am new to both Angular And Plunker and please help me where I go wrong with my assumption. Well, I just created a Plunker at following link:

https://plnkr.co/edit/zaZgTQgoEUZ6RsOilY7h

my Module looks like following:

(function() {

'use strict';

var maintenancePortabilityModule = angular.module('maintenance.portability.module',['ui.router']);

maintenancePortabilityModule.config([
    '$stateProvider',
    function ($stateProvider) {
        $stateProvider

           .state('portability',
            {
                abstract: true,
                url: '/portability',
                template: '<ui-view/>'
            })

             .state('portability.landing',
            {
                url: '/landing',
                templateUrl: 'index.html',
                controller: 'portabilityImportController'
            })

            .state('portability.import',
            {               
                url:'/import',
                templateUrl: 'import.html',
                controller: 'portabilityImportController'
            })
    }
]);


maintenancePortabilityModule.controller('portabilityImportController',
['$scope', 
    function ($scope) {
        $scope.Message = 'Hello welcome to import page';
    }
]);

})();

and my html looks like following:

> <h2>Data Package Management</h2>
> 
> <div ng-app="maintenance.portability.module" class="row push-down-md">
>     <div class="col-md-12">
>         <tabset>
>             <tab heading="Create">
>                 <div>
>                     Create Package
>                 </div>
>             </tab>
>             <tab  >
>                 <div>{{Message}}</div>
>             </tab>
>         </tabset>
>     </div>
>     </div>

I set up my Module, Controller and bound my to the module but it does not look like it is working. Probably I am missing something major. Can anyone help me get this plunker so that it can successfully absorb data from the controller and display the {{Message}} component correctly?

Upvotes: 0

Views: 98

Answers (1)

elfan
elfan

Reputation: 1131

Assuming you already have included the necessary libraries (because I didn't see them in your plunker):

<script data-require="[email protected]" data-semver="1.5.2" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.2/angular.js"></script>
<script data-require="ui-router@*" data-semver="1.0.0-beta.2" src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-router/1.0.0-beta.2/angular-ui-router.js"></script>
<script src="script.js"></script>

All you need to add is ng-controller="portabilityImportController".

Here is the plunker: https://plnkr.co/edit/HE278C7OubEDUVEXQceJ

Upvotes: 1

Related Questions