跳到主要內容

發表文章

目前顯示的是有「AngularJS」標籤的文章

angular muti on-finish-render

宣告 var App = angular.module('App', ['infinite-scroll']); App.directive('onFinishRender', function ($timeout) { return { restrict: 'A', link: function (scope, element, attr) { if (scope.$last === true) { $timeout(function () { scope.$emit(attr.broadcasteventname ? attr.broadcasteventname : 'ngRepeatFinished'); }); } } } }); Html {{p.Name}} {{n.Name}} Controller App.controller('Ctrl', function ($scope, $http,$sce) { $scope.$on("productsRepeatFinished", function(ngRepeatFinishedEvent) { console.log("Products"); }); $scope.$on("newsRepeatFinished", function(ngRepeatFinishedEvent) { console.log("News"); }); });

[Angular] AngularJS: Error: event is undefined (Firefox only)

在fireFox中使用AngularJS,會出現event is undefined 的錯誤, ex: < button ng-click="addStatus($event)"> ADD < /button> $scope . addStatus = function ( $event ){ $ ( event . target ). addClass ( 'added-status' ); } 需要修正為 < button ng-click="addStatus($event)"> ADD < /button> $scope . addStatus = function ( event ){ $ ( event . target ). addClass ( 'added-status' ); }

JS apply Angulars controller

js  var s = angular.element($('#DivID')).scope();  s.genData(t,m); //Call Controller function  s.$apply(function () {}); //Initial Controller app.controller('Ctrl', function ($scope, $http,$sce) {     $scope.title=""     $scope.message=""     $scope.genData=function(t,m){             $scope.title=t;             $scope.message=m;     }      $scope.renderHtml = function(html_code)      {         return $sce.trustAsHtml(html_code);      }; }); html  [div id="DivID"  ng-controller="msgLightboxCtrl" ]          [div class="row"]             [div class="col-sm-12"]                  [h3 class="title"]{{title}}[/h3]               ...

[JS Frame] angular js

今天在保哥的FB上看到簡單的介紹 Angular JS 只細看一下真的是個很好用的東西 以後寫js跟html的互動就跟寫in-line code的php asp一樣方便 真的太棒了。 不過還沒有時間好好研究 先留個檔 有空好好研究看看。 保哥的介紹:前端工程的極致精品: AngularJS 開發框架介紹