Câu hỏi được gắn thẻ «angularjs-controller»


8
Làm cách nào để sử dụng $ rootScope trong Angular để lưu trữ các biến?
Làm cách nào để sử dụng $rootScopeđể lưu trữ các biến trong bộ điều khiển mà tôi muốn truy cập sau này trong bộ điều khiển khác? Ví dụ: angular.module('myApp').controller('myCtrl', function($scope) { var a = //something in the scope //put it in the root scope }); angular.module('myApp').controller('myCtrl2', function($scope) { var …

10
Bộ điều khiển AngularJS có thể kế thừa từ bộ điều khiển khác trong cùng một mô-đun không?
Trong một mô-đun, bộ điều khiển có thể kế thừa các thuộc tính từ bộ điều khiển bên ngoài: var app = angular.module('angularjs-starter', []); var ParentCtrl = function ($scope, $location) { }; app.controller('ChildCtrl', function($scope, $injector) { $injector.invoke(ParentCtrl, this, {$scope: $scope}); }); Ví dụ qua: Liên kết chết : http://blog.omkarpatil.com/2013/02/controll-inherribution-in-angularjs.html Cũng …



Khi sử dụng trang web của chúng tôi, bạn xác nhận rằng bạn đã đọc và hiểu Chính sách cookie và Chính sách bảo mật của chúng tôi.
Licensed under cc by-sa 3.0 with attribution required.