【发布时间】:2015-06-26 10:34:39
【问题描述】:
我知道this 的问题几乎相同,但是我的实现需要稍微改变,我不知道该怎么做。
在我链接的答案中,涉及使用的解决方案
app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$routeProvider.
when('/test1', {template: 'page 1', controller: Test1Ctrl})
...
app.factory('Page', function(){
var title = 'default';
return {
title: function() { return title; },
setTitle: function(newTitle) { title = newTitle; }
};
});
function Test1Ctrl($scope, Page) {
Page.setTitle('title1');
}
...
在app.js 文件中。但是,我已经有了以下形式的配置:
...
$routeProvider
.when("/", {
templateUrl: "partials/landing.html", controller:"landingCtrl"
})
在另一个文件controllers.ts 中定义控制器landingCtrl,如下所示:
class landingCtrl {
public isFirstPlay: any;
constructor($scope) {
$scope.vm = this;
this.isFirstPlay = true;
}
...
那么我将如何在与此布局链接的答案中实现表单的功能?
【问题讨论】:
标签: javascript html angularjs partial-views html-heading