Angularjs 组件绑定行为奇怪
我正在尝试学习如何使用组件绑定功能。 所以我写了一个组件:Angularjs 组件绑定行为奇怪,angularjs,Angularjs,我正在尝试学习如何使用组件绑定功能。 所以我写了一个组件: 'use strict'; var module = angular.module("Test", []); module.controller("Controller2", Controller2); module.component("compo2", { controller: "Controller2", bindings: { url: "@", thing: "<"
'use strict';
var module = angular.module("Test", []);
module.controller("Controller2", Controller2);
module.component("compo2", {
controller: "Controller2",
bindings: {
url: "@",
thing: "<"
}
});
Controller2.$inject = ["$scope"];
function Controller2($scope) {
var self = this;
this.$onInit = function () {
}
}
“严格使用”;
变量模块=角度模块(“测试”,[]);
控制器模块(“控制器2”,控制器2);
组件(“compo2”{
控制器:“控制器2”,
绑定:{
网址:“@”,
事情:“如果你想使用试试thing=“'a911'”
。
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<script src="./Test/angular.js"></script>
<script src="./compoTest.js"></script>
</head>
<body ng-app="Test">
<compo2 url="www.test.com" thing="a911"> T.E.S.T </compo2>
</body>
</html>
<compo2 url="www.test.com" thing="vm.myString"> T.E.S.T </compo2>