我的角度块在我的MVC项目中不起作用。 [英] My angular chunk is not working in my MVC project.

查看:71
本文介绍了我的角度块在我的MVC项目中不起作用。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我想在我的项目中使用angular来将一些部分视图的数据保存在一个缓存位置。但是当我开始研究这个时,我发现代码正在处理示例项目不再适用于我的项目。它在我的布局页面上运行正常,但对我的部分页面效果不佳。



我尝试了什么:



Hi I want to use angular in my project to keep data of some partial views in one cache place. But when I started working on this I found that the code was working on sample project is no more working with my Project. It works fine on my layout page but do not good with my partial page.

What I have tried:

<script type="text/javascript" language="javascript">
        debugger;
        var myApp = angular.module('myApp', []);
        myApp.controller('abc', ['$scope'], function ($scope) {
            debugger;
            $scope.SomeId = "some id";
        });
</script>







然后在HTML中我使用ng-app = myApp在主div中然后ng-controller =abc和ng-model =SomeId在输入标签中。然后我尝试显示{{SomeId}}甚至是{{1 + 2}}之类的简单表达式,但没有任何效果。在调试时我发现第一个调试器得到了休息,但第二个调试器没有。浏览器也没有显示任何错误。

请帮助我解决问题。




Then in HTML I used ng-app = "myApp" in main div and then ng-controller = "abc" and ng-model = "SomeId" in input tag. I then tried to show {{SomeId}} or even simple expression like {{1+2}} and nothing is working. On debugging I came to know that the first debugger got the break but second one is not. Also browser is not showing any error.
Kindly help me the way out.

推荐答案

scope'],函数(
scope'], function (


scope){
debugger;
scope) { debugger;


scope.SomeId =some id;
});
< / script>
scope.SomeId = "some id"; }); </script>







然后在HTML中我使用ng-app = myApp在主div中然后ng-controller =abc和ng-model =SomeId在输入标签中。然后我尝试显示{{SomeId}}甚至是{{1 + 2}}之类的简单表达式,但没有任何效果。在调试时我发现第一个调试器得到了休息,但第二个调试器没有。浏览器也没有显示任何错误。

请帮我解决问题。




Then in HTML I used ng-app = "myApp" in main div and then ng-controller = "abc" and ng-model = "SomeId" in input tag. I then tried to show {{SomeId}} or even simple expression like {{1+2}} and nothing is working. On debugging I came to know that the first debugger got the break but second one is not. Also browser is not showing any error.
Kindly help me the way out.


这篇关于我的角度块在我的MVC项目中不起作用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆