铯图角度与剃刀



我正在使用c#构建一个具有客户端和服务器的Web应用程序。我正在使用铯图。我是这个材料的新手,有点困惑。谁能告诉我铯是否可以用Web api和angular实现?还是应该用剃须刀?有关系吗?

谢谢本。

我知道

你也在我们的邮件列表中问过这个问题,但我也想在这里回答它,以防其他人有类似的问题。

我也不熟悉晚餐,但就铯本身而言,这并不重要。 铯与工具包和服务器无关;它不关心您使用什么工具包或服务器技术,并且可以与所有这些一起使用。

Matt 是正确的,使用任何你喜欢的框架,但要花时间学习利弊。 你可以有一个带有嵌入式铯小部件的 Razor 模板(我自己也开发过这样的应用程序),只是要理解如果你离开页面,小部件就会被解除分配,所以用户在地图上"失去他们的位置"。 我没有使用过AngularJS,但看起来类似于Cesium用于自己的UI连接的Knockout。 如果页面上有操作小部件或其内容的控件,而无需导航,则这种客户端 UI 连接非常有用。

编辑:在铯球前面添加了Angular"TODO"演示应用程序的示例,以证明框架可以共存。

var viewer = new Cesium.Viewer('cesiumContainer', {
  navigationHelpButton: false, animation: false, timeline: false
});
angular.module('todoApp', [])
.controller('TodoListController', function() {
  var todoList = this;
  todoList.todos = [
    {text:'learn angular', done:true},
    {text:'build an angular app', done:false}];
  todoList.addTodo = function() {
    todoList.todos.push({text:todoList.todoText, done:false});
    todoList.todoText = '';
  };
  todoList.remaining = function() {
    var count = 0;
    angular.forEach(todoList.todos, function(todo) {
      count += todo.done ? 0 : 1;
    });
    return count;
  };
  todoList.archive = function() {
    var oldTodos = todoList.todos;
    todoList.todos = [];
    angular.forEach(oldTodos, function(todo) {
      if (!todo.done) { todoList.todos.push(todo); }
    });
  };
});
html, body, #cesiumContainer {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
  font-family: sans-serif;
}
.done-true {
  text-decoration: line-through;
  color: grey;
}
.controls {
  position: absolute;
  top: 5px;
  left: 8px;
  background-color: rgba(42, 42, 42, 0.7);
  padding: 5px 8px;
  color: #edffff;
}
<script src="http://cesiumjs.org/releases/1.16/Build/Cesium/Cesium.js"></script>
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.0.4/css/bootstrap-combined.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<link href="http://cesiumjs.org/releases/1.16/Build/Cesium/Widgets/widgets.css" 
          rel="stylesheet"/>
<div id="cesiumContainer"></div>
<div class="controls" ng-app="todoApp">
  <h2>AngularJS Todo</h2>
  <div ng-controller="TodoListController as todoList">
    <span>{{todoList.remaining()}} of {{todoList.todos.length}} remaining</span>
    [ <a href="" ng-click="todoList.archive()">archive</a> ]
    <ul class="unstyled">
      <li ng-repeat="todo in todoList.todos">
        <input type="checkbox" ng-model="todo.done">
        <span class="done-{{todo.done}}">{{todo.text}}</span>
      </li>
    </ul>
    <form ng-submit="todoList.addTodo()">
      <input type="text" ng-model="todoList.todoText"  size="30"
             placeholder="add new todo here">
      <input class="btn-primary" type="submit" value="add">
    </form>
  </div>
</div>

最新更新