Tôi có các tuyến mô-đun này:
var mainModule = angular.module('lpConnect', []).
    config(['$routeProvider', function ($routeProvider) {
    $routeProvider.
        when('/home', {template:'views/home.html', controller:HomeCtrl}).
        when('/admin', {template:'views/admin.html', controller:AdminCtrl}).
        otherwise({redirectTo:'/connect'});
}]);
Trang chủ HTML:
<div ng-include src="views.partial1"></div>
partial1 HTML:
<form ng-submit="addLine()">
    <input type="text" ng-model="lineText" size="30" placeholder="Type your message here">
</form>
HomeCtrl:
function HomeCtrl($scope, $location, $window, $http, Common) {
    ...
    $scope.views = {
        partial1:"views/partial1.html"
    };
    $scope.addLine = function () {
        $scope.chat.addLine($scope.lineText);
        $scope.lines.push({text:$scope.lineText});
        $scope.lineText = "";
    };
...
}
Trong addLinehàm $scope.lineTextlà undefined, điều này có thể được giải quyết bằng cách thêm ng-controller="HomeCtrl"vào partial1.html, tuy nhiên nó làm cho bộ điều khiển được gọi hai lần. Tôi đang thiếu gì ở đây?
