Angularjs ui视图不绑定到控制器

Angularjs ui视图不绑定到控制器,angularjs,angular-ui-router,Angularjs,Angular Ui Router,我第一次使用ui路由器。我查阅了一些教程,但始终无法使我的项目正常工作 我有一个带有控件的页面,我的文件home.htm get请求已完成,但ui视图未显示它 index.htm <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/an

我第一次使用ui路由器。我查阅了一些教程,但始终无法使我的项目正常工作

我有一个带有控件的页面,我的文件home.htm get请求已完成,但ui视图未显示它

index.htm

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.27/angular.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.15/angular-ui-router.min.js"></script>
  <script ng-include="'http://192.168.0.110/home.htm'"></script>

now home.htm

<!DOCTYPE html><!-- directive de repeat sur les données de vue channels -->
  <div class="IO_box" ng-repeat="channel in channels">
    <h2>{{channel.canal}}</h2>
    <button type="button" ng-click="switchChannel(channel, channel.canal)" ng-model="channel.status"> {{channel.status}} </button>
    <h2>
      <form> name:<br>
         <input type="text" name="Name" size="6" autocomplete="off" ng-model="channel.name" ng-focus="stopRefresh()" ng-blur="restartRefresh()">
         <button ng-click="channelsClk(channel, channel.name)">change</button>
  </form>
</h2>
    <br>
    <h4><span class="Ainput" >{{channel.temperature}}&#186;C</span></h4>
    <h2>Setpoint 
      <input type="number" name="setpoint" ng-model="channel.setPoint" ng-focus="stopRefresh()" ng-blur="restartRefresh()"
       min="5" max="30" step="0.5" size="1"> &#186;C   <br />
        <button ng-click="channelsClk(channel, channel.setPoint)">ok</button>
</h2>
    <h5>state: 
      <span class="permRun">{{channel.permRun}}</span>
</h5>
        <h5>
          <span class="AoutputChannel">{{channel.percent_out}}%</span>
</h5>

{{channel.canal}}
{{channel.status}
名称:
改变
{{通道温度}º;C 设定点 ºC
好啊 声明: {{channel.permRun} {{channel.percent_out}}

不需要将域放在templateUrl中。您还试图从您的内部ip地址获取它,但我认为您确实想访问localhost,它可以写成
http://localhost:PORT
其中,端口是服务器运行的任何端口

所以你的州定义应该是:

$stateProvider
    .state('/', {
        url:"/",
        templateUrl: './home.htm', //assumes this template is in the same dir as the state definition file
        controller:'temperatureCTRL'
});
此外,如果要显示其他模板,则需要将
添加到
home.htm
文件中,以便ui路由器知道在何处显示任何嵌套模板(正如Simon H评论的那样,不需要ng include)

与ui路由器无关,但您不需要将域名硬编码到
$http
请求中。Angular将使用当前域,如果您只编写例如
“/ajax\u inputs”
(在您的情况下,这应该可以,因为您正在尝试访问localhost)。如果你想访问另一个域,那么把它放在一个容易更改的变量中

getChannels: function(cb) {
    $http.get('/ajax_inputs')
        .then(function(result) { // .then with callback for error handling (success and error methods are being deprecated)
            cb(null, result);
    }, function(error) {
        // handle error here
    });
}

你的电话线错了。home.htm将被加载到div中,其上的指令ui视图已修复!!!细节简单但麻烦大!!:P这是更正:`我只在编程时使用域,因为服务和文件托管在arduino上。顺便说一句,我真的很想知道,出于这个原因,如何准确地将var和ADRESE放在一起…:P另外,我尝试将
添加到home.htm,但它并没有解决我的问题。请阅读评论以获得解决方案,simon H solution work!谢谢大家
getChannels: function(cb) {
    $http.get('/ajax_inputs')
        .then(function(result) { // .then with callback for error handling (success and error methods are being deprecated)
            cb(null, result);
    }, function(error) {
        // handle error here
    });
}