Javascript 在文本框中动态放置数据不工作

Javascript 在文本框中动态放置数据不工作,javascript,angularjs,Javascript,Angularjs,我无法使用ng模型将数据输入到上一页。我在文本框中填写了一些数据后移到下一页,来到同一页后,我希望输入的数据与以前输入的数据相同,我编写了代码,但不起作用。请告诉我我做错了什么,并提前感谢 js代码:- $scope.notesPage = function() { $rootScope.data = { Name: $scope.prospectName, }; $location.path('

我无法使用ng模型将数据输入到上一页。我在文本框中填写了一些数据后移到下一页,来到同一页后,我希望输入的数据与以前输入的数据相同,我编写了代码,但不起作用。请告诉我我做错了什么,并提前感谢

js代码:-

$scope.notesPage = function() {
        $rootScope.data = {
            Name:               $scope.prospectName,
        };
        $location.path('/prospectNotes');
    };

    $scope.addProspect = function() {
        $rootScope.data.ProspectNotes = $scope.notes;
        $scope.ProspectNotes = "";
    };

    function fillFormData() {
        $scope.prospectName = $rootScope.data.Name;
    }

    $scope.addProspectForm = function() {
        $location.path('/create');
        fillFormData();

    }

    first html page

    <div class = "container" id = "form-container">
            <div class = "form-group">
                <label for = "prospectName"> Prospect Name:
                    <img src = "images/required.gif" alt = "Required" class = "required-star">
                </label>

                <input type = "text" id = "prospectName" name = "prospectName" ng-model = "prospectName"
                       class = "form-control" required>
            </div>

            <div class = "form-group">

                <button type="submit" class="col-sm-2 btn btn-primary" ng-click="notesPage()"
                        style="margin-left:10px;"> Next </button>
            </div>
    </div>

     second html page

     <div class = "container" id = "form-container">

             <div class = "form-group">
                 <label for = "notes"> Notes for Prospect {{data.Name}}</label>
                 <textarea rows="20" id = "notes" name = "notes" ng-model = "notes" class = "form-control"></textarea>
             </div>

             <div class = "form-group">
                 <input type="button" id="cancel-button" value="Back" class="col-sm-2 btn btn-primary"
                        ng-click="addProspectForm()">
                 <button type="submit" class="col-sm-2 btn btn-primary" ng-click="addProspect()"
                         style="margin-left:10px;"> Add </button>
             </div>
     </div>
$scope.notesPage=function(){
$rootScope.data={
名称:$scope.prospectName,
};
$location.path('/prospectNotes');
};
$scope.addProspect=函数(){
$rootScope.data.ProspectNotes=$scope.notes;
$scope.notes=“”;
};
函数fillFormData(){
$scope.prospectName=$rootScope.data.Name;
}
$scope.addProspectForm=函数(){
$location.path('/create');
fillFormData();
}
第一个html页面
潜在客户名称:
下一个
第二个html页面
前景{{data.Name}的注释
添加

您是否使用$routeProvider进行路由?不,我没有使用$routeProvider$location.path(“/prospectNotes”);执行此操作时,它将在何处查找页面?当('/prospectNotes',{templateUrl:'views/addProspectNote.html',controller:'AddProspectCtrl',title:'Prospect Note'})两个页面都使用同一个控制器时,你能发布你的app.js吗?如果是,则检查$rootscope是否有值。