gpt4 book ai didi

javascript - AngularJS:模板中的第二个应用程序不起作用

转载 作者:行者123 更新时间:2023-11-30 16:54:59 25 4
gpt4 key购买 nike

<分区>

我有两个相同的应用程序(除了应用程序/ Controller 名称)紧接着彼此。第一个按预期工作,第二个显然根本没有执行。

我的代码(jsfiddle):

<div ng-app="passwdtool" ng-controller="PasswordController">
Password: <input ng-model="pass" required type="text"><br>
<span>{{ hash }}</span><br>
</div>

<div ng-app="passwdtool2" ng-controller="PasswordController2">
Password: <input ng-model="pass" required type="text"><br>
<span>{{ hash }}</span><br>
</div>
angular.module('passwdtool', [])
.controller('PasswordController', ['$scope', function($scope) {
$scope.pass = "password";
$scope.hash = "a hash";
}]);

angular.module('passwdtool2', [])
.controller('PasswordController2', ['$scope', function($scope) {
$scope.pass = "password";
$scope.hash = "a hash";
}]);

输出:

Password: [password]
a hash
Password: []
{{ hash }}

这是怎么回事?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com