Recently I follow a free tutorial on direct communication about the example.
index.html
& lt; Body ng-app = "app" & gt; & Lt; Country & gt; & Lt; State & gt; & Lt; City & gt; & Lt; / City & gt; & Lt; / State & gt; & Lt; / Country & gt; & Lt; / Body & gt;
app.js
var app = angular Module ('app', []); App.directive ('country', ['', function () {return} {controller: function} {this.makeAnnouncement = function (message) {console.log ("country says:" + message);}} }, Restrict: 'e'};}]); App.directive ('state', ['', function () {return} {controller: function} {this.makeLaw = function (law) {console.log ("law:" + law);};}, Restrict: 'e'};}]); ("Country", "^ State"), Link: Function ($ scope, IELM, iAttrs, Controller) ('City', ['', Function]) [Controller [0]. Macanensement ("From the City"); Controller [1]. Mclago ("Jump Up");}};}]);
But this error message is Unknown Provider: Provider & lt; - & lt; - went into error with cityDirective
. How can I solve it?
change it
app.directive ('country', [ '', Function () {
this
app.directive ('country', [function () {
In addition to state and city, you have an extra in declaring state directive
No comments:
Post a Comment