Javascript 需要angularjs SPA的建议吗

Javascript 需要angularjs SPA的建议吗,javascript,angularjs,Javascript,Angularjs,我正在写SPA,SPA几乎一直都有相同的结构(DOM)(除了授权表单)。视觉效果看起来完全一样,但它们之间没有什么不同。模型在不同的情况下是不同的,应用程序的行为取决于此时使用的模型。例如,一个模型如下所示: <table class="matrix" ng-if="search_result_type=='find_company'"> <tr ng-class="{matrix_row: !row.show}" ng-style="multiStyle(row, t

我正在写SPA,SPA几乎一直都有相同的结构(DOM)(除了授权表单)。视觉效果看起来完全一样,但它们之间没有什么不同。模型在不同的情况下是不同的,应用程序的行为取决于此时使用的模型。例如,一个模型如下所示:

<table class="matrix" ng-if="search_result_type=='find_company'">
    <tr ng-class="{matrix_row: !row.show}" ng-style="multiStyle(row, this)" class="animation" ng-repeat="row in search_result | filter:cacheTemplate track by $index">
        <td class="properties">{{row.name}}</td>
        <td class="properties" ng-if="isArray(row.contact)" ng-click="row.close!='disable' && row.show!=true ? row.show=true : null" colspan="{{row.show ? 2 : 1}}">
            <div ng-show="!row.show" ng-class="{multi_close : isMulti(row)}">{{row.contact[0].name}}</div>
            <div ng-repeat="ctx in row.contact track by $index" class="matrix_row multi_cell" style="line-height: 3; width: 100%; position: relative;" ng-show="row.show" ng-click="row.close!='disable' ? alert('загрузка контакта '+ ctx.name) : null">
                <div style="display: inline-block; width: 49%;">{{ctx.name}}</div>
                <div style="display: inline-block; width: 49%;">{{ctx.phone}}</div>
                <div class="block" ng-if="$index==row.contact.length-1" ng-mouseover="row.close='disable'" ng-mouseleave="row.close='enable'" ng-click="row.close!='enable'? row.show=false : null"></div>
            </div>

        </td>
        <td class="properties" ng-if="!isArray(row.contact)">{{row.contact}}</td>
        <td class="properties"  ng-show="!row.show">{{row.company_phone}}</td>
        <td class="properties">{{row.Legal_address}}</td>
    </tr>
</table>

{{row.name}
{{row.contact[0].name}
{{ctx.name}
{{ctx.phone}
{{row.contact}}
{{row.company_phone}}
{{row.Legal_address}
第二种模式:

 <table class="matrix" ng-if="search_result_type=='find_calculation'">
    <tr ng-class="{matrix_row: !row.show}" class="animation" ng-click="loadCalculation(row.id)" ng-style="multiStyle(row, this)" ng-repeat="row in search_result | filter:cacheTemplate track by $index">
        <td class="properties">{{row.name}}</td>
        <td class="properties">{{row.a_limit | currency:'RUB '}}</td>
        <td class="properties">{{row.total_price | currency:'RUB '}}</td>
        <td class="properties">{{row.amount}}</td>
        <td class="properties">{{row.date}}</td>
    </tr>
</table>

{{row.name}
{{row.a|u limit}货币:'RUB'}
{{row.total|u price}货币:'RUB'}
{{row.amount}}
{{row.date}
最后一点:

 <table class="matrix"  ng-if="search_result_type=='load_calculation'" ng-repeat="park in parks track by $index" ng-init="parentIndex = $index">
        <tbody>
            <tr ng-repeat="process in processes | filter : { park: parentIndex } track by $index">
                <td class="properties">{{process[1]}}</td>
                <td class="properties">{{process[2]}}</td>
                <td class="properties">{{process[3]}}</td>
                <td class="properties">{{process[4]}}</td>
                <td class="properties">{{process[5]}}</td>
                <td class="properties">{{process[6]}}</td>
            </tr>
        </tbody>
    </table>

{{进程[1]}
{{进程[2]}
{{进程[3]}
{{进程[4]}
{{进程[5]}
{{进程[6]}

我不是在寻找答案,而是在寻求建议。我需要使用多少控制器?每种型号一个?如果我让这个html结构完全相同,它会更好吗

I将只使用一个控制器,其中包含一些html内容,如

你也可以为这个控制器写一个工厂来处理相关的东西。
我认为没有必要使用多个控制器,但如果您使用一个或多个控制器,我想这取决于您的代码。

可能是一个组件/指令?为每个视图使用不同的控制器。将公共函数放入服务中。我的观点。主要基于观点许多好的问题都会根据专家经验产生一定程度的观点,但对这个问题的回答往往几乎完全基于观点,而不是事实、参考资料或特定的专业知识。