Hier Code:In eckigen, wie eine Funktion in einem Controller der Direktive definiert?
Richtlinie Code:
angular.module('app', ['localytics.directives', 'ngLoadScript'])
.directive("home", function() {
\t return {
\t \t restrict: "A",
\t \t replace: true,
\t \t template: "<div ng-include='var'>{{var}}</div>",
\t \t controller: function($scope) {
\t \t \t //loading home page - as default
\t \t \t $scope.var = "/tfm/home.html"
\t \t \t //on change the page changed dynamically!
\t \t \t $scope.change = function(where) {
\t \t \t \t $scope.var = where;
\t \t \t }
\t \t }
\t }
})
ICH WILL Chanage ANRUFEN (wo) FUNKTION DER RICHTLINIE - KONTROLLER der Richtlinie.
Controller-Code:
.controller('wToEatController', ['$scope', function($scope) {
\t $scope.submitInfoAboutTable = function() {
\t \t //validation for time selection
\t \t if($scope.idealTableTime == undefined || $scope.rightTableTime == undefined) {
\t \t \t return;
\t \t }
\t \t
\t \t //Booking details to be updated - here users preference is updating!
\t \t var bookingDetails = {
\t \t \t idealTableWaitTime: $scope.idealTableTime,
\t \t \t rightTableWaitTime: $scope.rightTableTime
\t \t }
\t \t
\t \t //Let's update booking information - the booking key will be same used while login, public/tfm.html
\t \t FirebaseDbService.updateBooking(function(isUpdated) {
\t \t \t console.log(isUpdated);
\t \t \t //I WANT TO CALL chanage(where) function of DIRECTIVE
\t \t \t $scope.change = "change('/tfm/home.html')";
\t \t }, bookingDetails, bookingKey);
\t } \t
}]);
Ist es möglich?
ein Dienst nicht – YOU
Service machen Richtlinie nicht funktioniert, die nicht Vorlage festgelegt wird: Vorlage: „
inject diesen Dienst sowohl Richtlinie und Controller – YOU