我有以下设置:
应用程序/指令
var app = angular.module("MyApp", []);
app.directive("adminRosterItem", function () {
return {
restrict: "E",
scope: {
displayText: "@"
},
template: "<td>{{ displayText }}</td>", // should I have this?
link: function(scope, element, attrs){
// What do I put here? I don't seem to have any
// element to initialize (set up event handlers, for example)
},
compile: function(?,?,?){} // should I have this? If so, what goes inside?
}
});
Run Code Online (Sandbox Code Playgroud)
调节器
function PositionsController($scope) {
$scope.positions = [{ Name: "Quarterback", Code: …Run Code Online (Sandbox Code Playgroud) javascript angularjs angularjs-directive angularjs-ng-repeat