gpt4 book ai didi

javascript - 普通 JavaScript 到 AngularJS

转载 作者:行者123 更新时间:2023-12-02 17:02:53 24 4
gpt4 key购买 nike

您好,请问有人知道吗:如何从纯 JavaScript 执行 AngularJs 方法。 =)谢谢。!!

myApp.controller("someController",["$scope",function($scope){
//Some code was here
$scope.a = valueA;
$scope.b = valueB
});

稍后在代码中想要执行一个函数,该函数在有效时可以执行 IF,如果是这种情况,将执行我的 AngularJS Controller 或其他内容。

function Clicked(){
if( was clicked correctly ){
//execute my Controller and send some data to add to the DOM
}

最佳答案

好吧,我认为这不是你真正想要的。看看https://docs.angularjs.org/api/ng/directive/ngClick 。您希望 HTML 元素触发 Controller 内的函数。

关于javascript - 普通 JavaScript 到 AngularJS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25550284/

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