ng-view的问题无法让它咬人! [英] Issue with ng-view can not get it to bite!

查看:80
本文介绍了ng-view的问题无法让它咬人!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

了解AngularJS的方法

我有一个运行的应用程序,JS适用于上面的APP,但我不能让JS(AngualrJS)使用视图。

HTML

在HTML中我称之为视图



< body ng-app =myApp>

.......

HTML和JS Code inbetween

。 .......

Learning the Ways of the AngularJS
I have an app running and the JS works for the APP above but I can not get the JS(AngualrJS) to work with the view.
HTML
In the HTML I am calling a view

<body ng-app ="myApp">
.......
HTML and JS Code inbetween
........



新区
< ng-view>




New Area
<ng-view>





我有3个一个ng-app上的控制器



JavaScript



我有这个返回视图

var app = angular.module('myApp',['ngRoute']);



.... .......



JS代码之间



........ ...

app.config(['$ routeProvider',

函数($ routeProvider){

$ routeProvider。

when('/ thesum',{

templateUrl:'about.html',

控制器:'myCtrl12'

});

}]);



app.controller('myCtrl2',function(){

var self = this;

self.message =你好! ;

});



我正在学习这个,以便了解如何使其与MSFT MVC世界一起工作,所以宝贝步骤任何帮助都很有用!



I have 3 controllers on the one ng-app

JavaScript

I have this to return the view
var app = angular.module('myApp', ['ngRoute']);

...........

JS Code between

...........
app.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/thesum', {
templateUrl: 'about.html',
controller: 'myCtrl12'
});
}]);

app.controller('myCtrl2', function(){
var self = this;
self.message ="Hello!";
});

I am learning this in order to understand how to get this to work with the MSFT MVC world, so baby steps any help is useful!

推荐答案

routeProvider',

函数(
routeProvider',
function(


routeProvider) {
routeProvider) {


routeProvider。

when('/ thesum',{

templateUrl:'about.html',

控制器:'myCtrl12'

});

}]);



app.controller('myCtrl2',function(){

var self = this;

self.message =你好!;

});



我学习这个以便了解如何使其与MSFT MVC世界一起工作,所以宝贝步骤任何帮助都是有用的!
routeProvider.
when('/thesum', {
templateUrl: 'about.html',
controller: 'myCtrl12'
});
}]);

app.controller('myCtrl2', function(){
var self = this;
self.message ="Hello!";
});

I am learning this in order to understand how to get this to work with the MSFT MVC world, so baby steps any help is useful!


这篇关于ng-view的问题无法让它咬人!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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