0

我是 AngularJs 的新手

如果我想在 html 中定义两个模型

我该如何定义它?

我试过很多次

请帮忙

<body ng-app="experiment">
<div  ng-controller="functionCrtl" id="staff"> 
<div ng-modle="data1.data">
   <ng-view></ng-view>  
</div>

<div ng-app="experiment_left">
<div ng-controller="accordtionCrtl">
    <div ng-model="accordtion.accordtion">
      <ng-view></ng-view>
    </div>
</div>

experiment.config (function($routeProvider) {
 $routeProvider.when("/",{
templateUrl : "function1.html",
controller: 'functionCrtl'});

我想动态加载两个页面,我该怎么做?

4

1 回答 1

0

但要回答您的问题,请阅读此http://docs.angularjs.org/api/ng.directive:input

控制器:

 angular.module('myApp').controller('CreateUserCtrl', function ($scope) {

         $scope.firstname = 'John';
         $scope.surname = 'Doe';
});

HTML

<form ng-controller="CreateUserCtrl">
     <input ng-model="firstname " type="text" placeholder="firstname">
     <input ng-model="surname" type="text" placeholder="surname">
</form>
于 2013-07-25T10:16:51.893 回答