angularjs - Angular Directive Does Not Load From JS FIle -



angularjs - Angular Directive Does Not Load From JS FIle -

my directive not loading .js file. can tell next info why directive not loading file?

my app.js file has

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

i have directive .js file called mydirective.js

inside file have

(function () { 'use strict'; var app = angular.module('mydirectives', []); app.directive('mymonth', function () { homecoming { restrict: 'ae', transclude: true, //priority: 1000, //scope: { // month: '=month' //}, template: '<select class="input-large" ng-model="month">' + '<option value="1">january</option>' + '<option value="2">february</option>' + '<option value="3">march</option>' + '<option value="4">april</option>' + '<option value="5">may</option>' + '<option value="6">june</option>' + '<option value="7">july</option>' + '<option value="8">august</option>' + '<option value="9">september</option>' + '<option value="10">october</option>' + '<option value="11">november</option>' + '<option value="12">december</option>' + '</select>', controller: function ($scope) { } }; }); });

inside index.html file have

<my-month></my-month>

can tell me why directive not load mydirective.js file load controller file? thanks

looks have errors in syntax.

first:

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

you don't need directives. i'm no means expert on angular js though, "correct" way it, not how end doing it.

next:

template: '<select class="input-large" ng-model="month">' +

should be:

template: [ '<select class="input-large" ng-model="month">',

you need create sure include file in index.html somewhere

here's working plunker: http://plnkr.co/edit/xtthqwe2yw7e9ko05ios

angularjs angularjs-directive

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -